[fpc-devel] assign constant text to widestring
Michael Schnell
mschnell at lumino.de
Thu Oct 23 09:20:21 CEST 2008
> If anybody say another thing "UTF8String" is just an alias for
> "ansistring" so they are exactly the same thing, but with different
> name which in my case I'm using to be clear in code where things are
> utf-8 encoded.
>
I do know that in the current implementation "UTF8String" is just an
alias for "ansistring". Of course this is why the compiler can't do any
special tricks when assigning an utf8 coded value to a WideString.
So for a decent handling of UTF8, it is necessary to implement
UTF8String as a basic type the compiler is aware of.
While the constant assignment problem is something we seem to see in any
use of FPC, when doing Lazarus, the problem is even a lot more
prominent, as the new LCL has been changed to use UTF8 instead of ANSI
in it's user interface. Thus using any LCL function in a WideString
based project uses the wrong (ANSI) default type conversion (-> no error
message but wrong behavior as soon as - and only if - Unicode characters
> $7F are used.) .
(I have no idea why the Lazarus people decided to use utf8 instead of
plain WideString for Unicode support. At least half the Lazarus projects
are on Windows and same does have a WideString API so another type
conversion is necessary in within the LCL, I don't know how the GTK API
works.)
-Michael
More information about the fpc-devel
mailing list