Hi all,
Thanks for reading my question!
First of all some basic stats: I am using Delphi 7 Enterprise along with the Indy 9 component set. (The version of 10 you can download from the Indy website seems glitchy hence I've switched back to version 9).
My program uses idHTTP to collect data from various websites and puts it in one page. But now I have run in the follow problem:
I have a stringlist with data that I wish to remove prior to displaying the result. So I use your basic for...to...do loop to go through the entire mass of data collected and the list to do my case insensitive compares by using the CompareText() function. But it wouldn't remove the data even though it was clearly there. So after some research I have come to the conclusion that this is due to the code pages or character sets the various websites use, which are:
UTF8, ISO-8859-1 and ISO-8859-15
I have gotten this info from reading out the <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> information. (This site for example uses UTF-8).
So that is part of the problem solved, at least I know what I am dealing with.
So then I started by diving into the Delphi help and I came across idHTTP's AcceptCharSet request-header thingamajig. Having run trials with it all the websites will still return the "everything's cool n froody" statuscode 200 even though they apparantly still deliver the pages in whatever encoding they had it originally in without supplying the "406 Not Acceptable" statuscode as they are supposed to (according to (even though it says that supplying an unacceptable character set is acceptable :S)) if they can't deliver in said charset. So that is pretty much useless to me.
Of course, I also came across the various character set switching utilities provided by Delphi such as UTF8Encode() for example.
Now I am facing the following problems:
1. What code page is Delphi using? I cannot seem to find this information.
2. What would the best way be to handle this problem? I know which website delivers the HTML-document in which charset, but now how to move ahead?
I hope I explained my problem thoroughly enough and I hope you guys can help me out because I am having a serious case of cerebral flatulence here.
Kind regards,
BobbaFet
Thanks for reading my question!
First of all some basic stats: I am using Delphi 7 Enterprise along with the Indy 9 component set. (The version of 10 you can download from the Indy website seems glitchy hence I've switched back to version 9).
My program uses idHTTP to collect data from various websites and puts it in one page. But now I have run in the follow problem:
I have a stringlist with data that I wish to remove prior to displaying the result. So I use your basic for...to...do loop to go through the entire mass of data collected and the list to do my case insensitive compares by using the CompareText() function. But it wouldn't remove the data even though it was clearly there. So after some research I have come to the conclusion that this is due to the code pages or character sets the various websites use, which are:
UTF8, ISO-8859-1 and ISO-8859-15
I have gotten this info from reading out the <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> information. (This site for example uses UTF-8).
So that is part of the problem solved, at least I know what I am dealing with.
So then I started by diving into the Delphi help and I came across idHTTP's AcceptCharSet request-header thingamajig. Having run trials with it all the websites will still return the "everything's cool n froody" statuscode 200 even though they apparantly still deliver the pages in whatever encoding they had it originally in without supplying the "406 Not Acceptable" statuscode as they are supposed to (according to (even though it says that supplying an unacceptable character set is acceptable :S)) if they can't deliver in said charset. So that is pretty much useless to me.
Of course, I also came across the various character set switching utilities provided by Delphi such as UTF8Encode() for example.
Now I am facing the following problems:
1. What code page is Delphi using? I cannot seem to find this information.
2. What would the best way be to handle this problem? I know which website delivers the HTML-document in which charset, but now how to move ahead?
I hope I explained my problem thoroughly enough and I hope you guys can help me out because I am having a serious case of cerebral flatulence here.
Kind regards,
BobbaFet
Code:
if not Programming = 'Severe Migraine' then
ShowMessage('Eureka!');