[fpc-pascal] Read lines into UnicodeString variable from UCS2 (UTF-16) encoded text file
Tomas Hajny
XHajT03 at hajny.biz
Wed Sep 4 20:16:02 CEST 2019
On 2019-09-04 13:39, LacaK wrote:
>> You may be able to improve on this using system.BlockRead.
> Probably yes, but then I must read in local buffer and examine buffer
> for CR/LF.
>
> And return from my function UCS2ReadLn() only portion of string up to
> CR/LF and rest of string return on next call to my function.
> (so I must keep unprocessed part in global buffer)
>
>
>> Also, you are assuming low order byte first which may not be portable.
>
> Yes, In my case LE is sufficient as far as I check presence of BOM
> $FF$FE
Just as a comment - a contribution allowing ReadLn to read UTF-16 files
(preferably complete from functional point of view, especially without
shortcuts like handling only UCS2 instead of complete Unicode) would be
obviously welcome.
Tomas
More information about the fpc-pascal
mailing list