[Lazarus] UTF8String and UTF8Delete

Bart bartjunk64 at gmail.com
Sun Dec 13 13:02:52 CET 2015


On 12/13/15, Jürgen Hestermann <juergen.hestermann at gmx.de> wrote:

>  > 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.

No, it is there for Delphi compatibility, so it should not be removed.

> 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).

Yes,it it confusing.

> 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 changing all strings in Lazars/LCL to Utf8String is not going to happen.
No Lazarus code would be compatible with Delphi anymore if we did.


> 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).

Var parameters must be of exactly the same type.
This is what makes Pascal a safer tool than C for example.

> I would expect that *all* ansistrings are assignement compatible.

They are assignment compatible.

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

I don't think it is that easy.

We should fix the specific UTF8* functions to accept UTF8String parameters.

Bart




More information about the Lazarus mailing list