is there any smart way how to read string data line by line from UCS2
encoded text files (lines delimited by $0A00).
So, some LoadFromFile with a stream is no option for you?
It should be an option, but AFAIK LoadFromFile with optional TEncoding is not a part of FPC 3.0.4

It is only in upcoming 3.2.0 ...



I wonder if Delphi supports ReadLn() for UTF-16 encoded text files ...?
 From what I gather from the Embarcadero wiki and google searches it does not.
I only have D7 so I cannot test that myself though,

Seems you need to use LoadFromFile with a TEncoding specified, see:
http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Using_TEncoding_for_Unicode_Files

Yes it was my impression also ... I was wondering if there is other way?
(best using ReadLn() ... so I can open TextFile, then read first 2-3 bytes (BOM) and detect what encoding file has (UTF-8 or UTF-16) and then either use ReadLn with AnsiString (UTF-8 case) or UnicodeString (UTF-16 case))

L.


Bart
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to