[Lazarus] cwstring in arm-linux

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Wed Oct 19 20:49:14 CEST 2011


On 10/19/11, Vincent Snijders <vincent.snijders at gmail.com> wrote:
> I guess Felipe gave up waiting on a Unicode RTL for the time being and
> goes for a full UTF8 pseudo RTL in LazUtils.

Well, after a lot of discussion I got convinced that Lazarus should
give a try at the UTF-8 mode of the RTL when this appears, and this
might be very useful for our usage of TStringList, TComponent,
TStream, etc. I think this solution has major problems, but it was
claimed that my proposed solutions have much worse problems, so in the
end I concluded that we should try the UTF-8 mode of the RTL when it
appears.

But this does not mean that LazUtils would not be useful then. My
proposals to add UTF-8 routines to the RTL and even FCL were rejected,
so we UTF-8 users would need to be stuck with only whatever routines
Embarcadero invents. That's not nearly good enough and not nearly fast
enough. UTF8LowerCase is very superior to the existing RTL LowerCase.
To start with, the RTL in existing release doesn't even have a
UTF8String LowerCase (no idea about 2.7). Also, UTF8LowerCase has a
second parameter to specify the language, so we can test and support
Turkish without having to change our locale to turkish, and it
outperforms SysUtils.UnicodeLowerCase by 250% aprox in my Mac, and it
has zero external dependencies while depending on zero initialization
code, zero global variables and having 1k lines of code (half of them
comments), which is not that much. As you can see it vastly
outperforms even what the UTF-8 mode of the RTL would offer for this.

Just like UTF8LowerCase, other things provided by LazUtils will also
be useful options for Lazarus and other libraries/applications,
regardless of FPC offering something similar. And then I think that
everyone will be happy. People that want Delphi compatibility
(excluding string and PChar, since they will not match in the RTL mode
used by Lazarus) will be happy, they can use RTL routines and get
compatibility. Lazarus will still be using string and TStringList,
TComponent, etc.

-- 
Felipe Monteiro de Carvalho




More information about the Lazarus mailing list