Hi all,
quick question:
- I have a text file coming from somewhere, containg Names, one per Line. When reading it using FPC, the German language "Umlauts" (äöüÄÖÜ) get replaced with "?" characters. Looking into it using a hex editor I see that the file was encoded 1 byte per character, codepage was obviously ISO/IEC 8859-1 ("ü" = #fc, ...), Line-Ends are CR-LF (#0d#0a) not quite an unusual file format, I guess.
How can I read this file into Free Pascal line by line, keeping the special characters intact???
I tried:
var F:Text;
...
readln(F,Buffer);
with Buffer beeing of type ShortString,AnsiString and UTF8String, no success.
var S:TStringList;
...
S := TStringList.Create;
Stringlist.LoadFromFile(Filename)
...
No sucess either. Using any of the conversion routines like AnsiToUTF8 and such does, of course, also fail, since the damage is already done after reading. I searched the FPC docs up and down to find any way to set a codepage for reading - no success either.
This problem has been described several times, and some people trying to help produced quite lengthy rants about flimsy Codepage support in FPC, but no solution. The docs weren't helpful as well, seems issues reading such files aren't of anyone's interest.
Simple question: how can I read those files properly.
Thx
Armin.