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

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

Reply via email to