Ikke
2010-02-08 22:00:33 UTC
Hi everybody,
I'm trying to read data from an xml file I've downloaded from the
internet. Whenever I encounter a character like for instance "ä", it is
displayed as two strange characters.
After looking at the file with a hex editor, I've discovered that the
file starts with FFFE, and that each character in the text file takes up
two bytes (3C00 7200 6500 and so on).
To read the file, I've already tried the following two methods, each gave
me the funny characters instead of what I was expecting:
... method one ...
sl := TStringList.Create;
sl.LoadFromFile('c:\1.xml');
FreeAndNil(sl);
... method two ...
AssignFile(tf, 'c:\1.xml');
ReSet(tf);
while Not(eof(tf)) do
begin
ReadLn(tf, s);
end;
CloseFile(tf);
What do I need to do to read this file as plain text, and to get the
characters which are actually in the file (instead of funny
interpretations)?
Any help would be very much appreciated!
Thanks,
Ikke
I'm trying to read data from an xml file I've downloaded from the
internet. Whenever I encounter a character like for instance "ä", it is
displayed as two strange characters.
After looking at the file with a hex editor, I've discovered that the
file starts with FFFE, and that each character in the text file takes up
two bytes (3C00 7200 6500 and so on).
To read the file, I've already tried the following two methods, each gave
me the funny characters instead of what I was expecting:
... method one ...
sl := TStringList.Create;
sl.LoadFromFile('c:\1.xml');
FreeAndNil(sl);
... method two ...
AssignFile(tf, 'c:\1.xml');
ReSet(tf);
while Not(eof(tf)) do
begin
ReadLn(tf, s);
end;
CloseFile(tf);
What do I need to do to read this file as plain text, and to get the
characters which are actually in the file (instead of funny
interpretations)?
Any help would be very much appreciated!
Thanks,
Ikke