[fpc-pascal] Read lines into UnicodeString variable from UCS2 (UTF-16) encoded text file

Bart bartjunk64 at gmail.com
Wed Sep 4 10:32:12 CEST 2019


On Wed, Sep 4, 2019 at 7:46 AM LacaK <lacak at zoznam.sk> wrote:

> 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?

> 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

Bart
-- 
Bart


More information about the fpc-pascal mailing list