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

cobines cobines at gmail.com
Tue Sep 20 14:44:22 CEST 2011


2011/9/20 Michael Schnell <mschnell at lumino.de>:
> 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.

The code page will be stored in the record describing the string, you
will be able to read it with something like StringCodePage(s).

> 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.

With the code page aware strings it will be able to detect encoding
and do UTF-8<->UTF-16 too.

--
cobines




More information about the Lazarus mailing list