[Lazarus] Does Lazarus support a complete Unicode Component Library?

Vladimir Zhirov vvzh.lists at gmail.com
Sun Jan 2 00:14:46 CET 2011


Juha Manninen wrote:

> What happens when I do:
>   var s: string;
>   ...
>   s := TMemo.Lines[0];
> 
> Is it converted somehow?
> The native widget's encoding is either UTF-8 or UTF-16.
> Is the string actually a Utf8String or Utf16String then?
> When do I need to pay attention to it?

The string is Utf8String (= AnsiString for now and in the near
future), as Sven pointed out. 

You need to pay attention to it when you cross the boundary
between FPC's RTL/FCL and LCL. LCL uses utf-8 regardless
of underlying widgetset, but RTL/FCL uses platform-specific
encoding. IIRC most if not all encoding dependent routines
of RTL/FCL are related to file operations and I/O.

LCL provides functions for platform-independent conversion
between utf-8 and platform-specific encoding (see FileUtil unit):

1. Utf8ToSys/SysToUtf8 as general-purpose functions;
2. Set of wrappers such as FileExistsUtf8, FindFirstUtf8 etc.
   to make our code more readable.




More information about the Lazarus mailing list