[Lazarus] Removed use of UTF8String in Lazarus to work with cpstrnew

Michael Schnell mschnell at lumino.de
Tue Sep 20 14:16:37 CEST 2011


On 09/20/2011 01:09 PM, cobines wrote:
> String=AnsiString(CP_UTF8),
Meaning that a library function (or an FPC syntax candy feature) can't 
detect the code that is used for the string.
> If you mean UTF-16 UnicodeString then I don't think there will be a
> problem.
AFAIK, Lazarus does not use UTF-16 (other than in the Windows API)
> If your program or library uses UTF-16 and Lazarus uses UTF-8
> the conversion routines will be inserted automatically by the compiler
> where needed.
If the application programmer uses any 8 bit coding (such as ANSI or 
UTF-8), as said, the type does not denote the coding, thus there can't 
be an automatic conversion.

AFAIK, automatic correct UTF-8 to UTF-16 conversion is not done by the 
compiler when assigning an "String" to a "WideString". The string type 
the compiler sees (after evaluation the type alias) is ANSIString, so 
maybe it does an ANSI to UTF-16 conversion.

-Michael




More information about the Lazarus mailing list