[fpc-pascal] FPC 3 regression: cannot use TStringList for UTF-8 data any more?

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Apr 19 08:22:51 CEST 2016


Michael Schnell wrote:
> On 04/16/2016 11:02 AM, Mattias Gaertner wrote:
>> For instance using {$codepage utf8} tells the compiler to convert all
>> your literals to UTF-16. Without the {$codepage} the compiler
>> preserves the real codepage.
> I.e. (compiling in a UTF-8 based Linux)
>
> - using {$codepage utf8} tells the compiler to convert all your literals
> to UTF-16

That's a, wrongly described, implementation detail. When any {$codepage 
xxx} directive is specified, string constants in the source are 
represented in a way that makes lossless conversion to any other code 
page possible. This conversion to the target code page is performed at 
compile time where possible (when the target code page cannot change at 
run time), and otherwise at run time.

What this internal lossless representation is at compile time and/or run 
time is undefined.

> - not using {$codepage utf8} tells the compiler to convert all your
> literals to UTF-8

No, it does not. Please tell me which sentence of 
http://wiki.freepascal.org/FPC_Unicode_support#String_constants suggests 
that in any way.


Jonas



More information about the fpc-pascal mailing list