Op Thu, 23 Oct 2008, schreef Michael Schnell:

I suppose this might solve the constant assignment on the fly, but in fact I feel that the compiler should generate a WideString constant at compile time instead of calling a conversion function at run time.

Then you don't understand it yet, I think. If the compiler knows your source file is UTF-8 (by BOM or directive), the compiler generates a widestring constant and no conversion function is called when assigning to a widestring.

However, if you assing this constant to an utf8string, the compiler does a wide->ansi conversion, which is done according to the system code page, as the compiler does not know the difference between an ansistring and an utf8string. In this case you would need to utf8decode your widestring constant to get in in your ansistring in UTF-8 encoding.

Daniël
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to