[Lazarus] UTF8String and UTF8Delete

Jürgen Hestermann juergen.hestermann at gmx.de
Sat Dec 12 17:48:28 CET 2015


Am 2015-12-12 um 17:25 schrieb Juha Manninen:
> On Sat, Dec 12, 2015 at 1:46 PM, Jürgen Hestermann
> <juergen.hestermann at gmx.de> wrote:
>> Otherwise we would not have this problem and could use UTF-8 as
>> a standard for everything.
> What is the problem exactly?
> Always call the Windows API 'W'-functions and use proper data types for them.
> The dynamic string encoding and conversion will take care of everything else.
>
>
The problem is the "proper data type".

In the past I used UTF8String for all my strings
and converted to UTF-16 before feeding them into
Windows API 'W' functions.
That worked very well it was totally clear what happened.

Now these programs do not compile anymore
because UTF8Delete expects STRING and cannot
be used with UTF8String (which is realy rediculous:
a function which only works on UTF-8 strings but
refuses to work with type UTF8String).
I have now to move back to type STRING and
somehow (did not find out yet) tell the system
that STRING should be UTF-8 all the time.

To add to the confusion there are multiple global
code page variables which can be switched to UTF-8
but I don't know which to use and what side effekts each have.

Before FPC 3.0 everything was clear but now
I don't know how to do it.




More information about the Lazarus mailing list