[Lazarus] UTF8String and UTF8Delete

Jürgen Hestermann juergen.hestermann at gmx.de
Sun Dec 13 11:37:17 CET 2015


Am 2015-12-12 um 19:34 schrieb Bart:
 > There is no need for such a tone, please!

That's what I thought too as I read Juha's answer
telling me that I was just too "dummy" to have used UTF8Strings.


 > Grasping the concepts of the new CP aware strings and all it's
 > implications is not that easy.

True. Still many here say that you just need "to read the wiki"
and all is clear. But that's not true.


 > And hence, at that point in time, there would (for programmers using
 > Lazarus) bee no need to use the type Utf8String at all.

Then I would suggest to remove this type.


 > I can see why you felt it was logical to have your strings being of
 > type Utf8Strings, but unfortunately for you, it now turns out to be
 > not such a good choice.

It is of course quite easy to rename string types, but that's not the point.
It is just totally confusing that Free Pascal (still) provides
an UTF8String type but it cannot be used anymore (not even for
routines that *only* work on UTF-8 strings).
If UTF-8 is the choice (which is good) then STRING should be replaced
by UTF8String so everybody instantly knows what he is using.

But I still don't understand the rationale behind the decision to not allow
ansistring(A) to be fed into a var parameter of ansistring(B).
I would expect that *all* ansistrings are assignement compatible.
Insisting on having the same *static* codepage does not make sure that these
strings have the same (dynamic) code page at run time.
Assigning 2 strings with different static code pages has the same risk as
if their static code pages are equal, they still may or may not have the
same encoding.

Allowing all ansistrings to be compatible would also remove the
problem with UTF8String and LazUTF8 routines.





More information about the Lazarus mailing list