[Lazarus] Lazarus (UTF8) and Windows: SysToUTF8, UTF8ToSys... Is there a better solution?

Marcos Douglas md at delfire.net
Sat Dec 21 02:08:52 CET 2013


On Fri, Dec 20, 2013 at 4:22 AM, Juha Manninen
<juha.manninen62 at gmail.com> wrote:
> On Fri, Dec 20, 2013 at 2:47 AM, Marcos Douglas <md at delfire.net> wrote:
>> Not _only_ to UTF-16? It will depend on the OS?
>
> No, FPC string will know its encoding and the conversion is made to
> any encoding but only when needed.
> Let's not go deeper into this subject here. The details of future FPC
> are still open and they are not yet documented.
> When "Unicode" is mentioned, usually people start to argue about how
> it SHOULD be done.
> You can search in fpc-pascal and fpc-dev histories for that.

Ok, you're right.

>> For now (2.6.2) works ok only for AnsiString... I'm talking about
>> codify TStringList class to work with UTF-8 but no changes in string
>> type arguments.
>
> Again no. TStringList in 2.6.2 works ok for UTF-8 encoded strings, too.
> The same is true for future FPC versions because they are not
> hard-coded for UTF-16 (as Delphi is).

I didn't understand. If I have a TStringList instance, on Windows, I
need to convert Text property to ANSI. But some components, e.g.
TMemo, do these conversions automatically, but this is different.

>>> With Delphi you would need to copy the whole class, name it
>>> TUtf8StringList, and replace "string" with "UTF8String".
>>> This new class must NOT inherit from Classes.TStringList.
>>
>> The same here... I think.
>
> No no no :)
But you talking about to make a new StringList... this is not the proposal.  ;-)

Marcos Douglas




More information about the Lazarus mailing list