[Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

Juha Manninen juha.manninen62 at gmail.com
Thu May 4 16:56:00 CEST 2017


On Thu, May 4, 2017 at 2:47 PM, wkitty42--- via Lazarus
<lazarus at lists.lazarus-ide.org> wrote:
> On 05/03/2017 05:21 AM, Juha Manninen via Lazarus wrote:
>> Encoding does not matter any more, as long as it is Unicode.
>
> reminds me of a saying that is attributed to Henry Ford...
> Any customer can have a car painted any color that he wants so long as it is
> black.

Ok, maybe my wording was not good.
I believe everybody is happy to get rid of the horrendous Windows
system codepages and the question marks in text.
Unicode is a good thing!
The LazUnicode unit provides a solution for encoding agnostic code.
Yes. It is no joke.

There has been many wars about UTF-8 <> UTF-16 encoding supremacy.
They look ridiculous for anybody who knows the complexity of Unicode.
The complexity is not related to encodings, it is at the abstract
Unicode level where encodings have no effect.

Currently Delphi and Lazarus use a different encoding. Some people see
it as a problem. LazUnicode proves it is not a problem. You can write
code that works with both. Codepoints in both encodings have variable
width, thus they must use the same fundamental concepts. It was easy
to write functions to support them both.
However LazUnicode does not solve the problems at abstract Unicode
level and nobody claims so.

Another fact is that lots of UTF-16 code out there is broken because
people treat UTF-16 as fixed width encoding for some reason. Using
LazUnicode unit improves the situation. The code will inevitably work
right with both encodings.
I have seen comments saying that treating UTF-16 as fixed width
encoding is OK because the characters outside BMP are so rare. It is
like saying that a buggy spreadsheet app is OK because it calculates
the sums wrong only sometimes.
IMO such people should not do programming.

I have not seen any feedback or comments about LazUnicode so far.
I guess it means that nobody uses it. :(

Juha


More information about the Lazarus mailing list