[Lazarus] Converting all code to use UnicodeString

Marcos Douglas B. Santos md at delfire.net
Mon Sep 25 23:11:22 CEST 2017

Hi Mattias,

On Mon, Sep 25, 2017 at 5:45 PM, Mattias Gaertner via Lazarus
<lazarus at lists.lazarus-ide.org> wrote:
> On Mon, 25 Sep 2017 17:18:05 -0300
> "Marcos Douglas B. Santos via Lazarus" <lazarus at lists.lazarus-ide.org>
> wrote:
> Your first email does not contain a simple Lazarus+string example. I
> see an example for LCL+unicodestring.

Yes, because I tried to make the code compatible. If Delphi uses UTF16
there is some logic to use it the same encode... I thought.

>> I know almost nothing about compilers. But IMHO, the compiler should
>> have which it already have: "string", which is an alias.
>> Then, for each OS, we should pass one argument like (simplifying):
>> -S=UnicodeString  or -S=AnsiString... something like that (I hope you
>> understood).
> The flags are -MDelphiUnicode, -MDelphi or -MObjFPC.
> But they only compile the units with sources in the unit path, which
> excludes all FPC units. Also keep in mind that the system unit and the
> RTL require a lot of low level functions, which require separate
> versions.

Which make this flags useless for that. It should be all code (my,
RTL, Lazarus, etc) to make this work using one type of string.

>> I mean, we should not have overload functions, but only one type of
>> string. Even if that type may be RawByteString.
> From a user pov: Yes, that's what Lazarus is recommending: Simply use
> one string type, and that is String. The confusion starts when you start
> using different string types.

Yeah, but DOM uses DOMString, which is WideString.
Lazarus uses UTF8 and have a laz2_DOM that uses "string", which is
UTF8, but I cannot use this unit with XPath unit, which needs a
TXMLDocument that works with WideString... see my point?
RTL was only ANSI, now has overload to UnicodeString... but according
with Sven, the Unicode support is not finished yet.

And what about the huge Warnings between these units, do you think
that is normal to use cast on everything?

> Unicode <> UnicodeString
> Unicode is working with UTF-8.
> If you want a Delphi compatible UTF-16 RTL and packages you are welcome
> to help the FPC team.

I can help in a high level way (Classes, Components, etc) not in the
compiler level.
But how can I know about these tasks? May I just pick one in bug
tracker that I want? How to know who is working on each task, which is
more important?

Best regards,
Marcos Douglas

More information about the Lazarus mailing list