[Lazarus] TStrings, Windows and Unicode

Hans-Peter Diettrich DrDiettrich1 at aol.com
Wed Oct 24 15:58:49 CEST 2012

J├╝rgen Hestermann schrieb:
> Am 2012-10-24 08:58, schrieb Howard Page-Clark:
>  > Internally the LCL uses only UTF8 encoding,
>  > so stringlists etc. all expect strings in that
>  > encoding and process them correctly when supplied
>  > (as here) with a string from the IDE Editor which
>  > is also UTF8. However the streaming code in SaveToFile
>  > eventually calls some Windows system routine which
>  > does not handle UTF8 and so requires conversion
>  > from the UTF8 filename to be correctly handled.
> That's one of the most important drawbacks of Lazarus:
> The handling of strings is not consistent in all cases.
> There is the theory of having UTF8 but in practice you have to
> watch out because in *some* situations the UTF8 paradigma
> is *not* valid and you have to convert strings yourself.

This will change with the new Unicode and Ansi strings, which have a 
defined Encoding.

Once the Encoding comes, I'd vote for an dedicated TFileName string 
type, that matches the platform conventions. This type will allow to 
handle filenames in the platform specific part of the RTL easily, 
without too many string conversions.


More information about the Lazarus mailing list