[Lazarus] Reading a file that contains UTF-8 text

Graeme Geldenhuys graemeg at opensoft.homeip.net
Thu Jul 9 15:34:08 CEST 2009


Zaher Dirkey wrote:
> I always use TStream based objects Like TFileStream, and forbid to my
> coworkers from using AssignFile and ReadLn or WriteLn and other
> functions in the same family.

That made no difference, though the actual code looks clearner.

I then tried to view the file with mc (Midnight Commander), and I 
couldn't read the unicode characters, they only appears as dots. I then 
opened the file in gEdit (Gnome Editor) and when I tried to save it, 
gEdit complained and said it couldn't save the file using the encoding 
ISO-8859-15 (What????) and if I would like to save it as UTF-8 instead. 
I said yes.

Now my program reads the file just fine, and the writeln() output is 
also readable.  So I have no idea what happened with the original data 
file to start with. Anyway, the problem is now solved.


Regards,
   - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/





More information about the Lazarus mailing list