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

Michael Schnell mschnell at lumino.de
Fri Apr 15 10:43:55 CEST 2016


On 04/15/2016 10:32 AM, Graeme Geldenhuys wrote:
> If you as a programmer knows the unit is saved in UTF-8 encoding, then 
> add {$codepage utf8} to the top of the unit. That tells the compiler 
> how to interpret string constants in that unit (without the need for 
> any guessing).

I did some test with results that I can't get sorted.

Do you suggest that the codepage of the sourcecode is preserved by the 
compiler when creating the string constant in object code  ? I did not 
expect this but it of course is a possible way to go.

But if that is true, StringCodePage of a constant never should return 0 
which is CP_ACP, which is supposed to mean "in fact its the value of 
DefaultSystemcodepage" and hence is not predefined in the executable file.

Seemingly StringCodePage does not work correctly with string constants 
anyway: I found that setting {$codepage UTF8}, for a constant string I 
get StringCodePage = 1200 which is UTF16.

-Michael




More information about the fpc-pascal mailing list