On 13 Oct 2011, at 15:02, Paul Ishenin wrote:
Then use {$codepage UTF8} only. This directive treats all ansistring
constants in UTF8 codepage. So the next code:
{$codepage UTF8}
var
s: ansistring;
begin
s := 'utf8 string';
WriteLn(StringCodePage(s));
end.
will output CP_UTF8 constant.
This I don't really understand. Shouldn't the constant be converted at
run time from UTF-8 to the DefaultSystemCodePage to make sure that an
ansistring(0) variable always contains strings encoded in the
DefaultSystemCodePage? If you assign e.g. a string(866) variable to a
plain ansistring variable, then such a conversion is also done, no?
I think the only case in which the source code encoding should be kept
is in case you assign the string constant to a rawbytestring.
Jonas
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel