[fpc-devel] simple UTF tests
mschnell at lumino.de
Fri Jan 6 11:07:59 CET 2012
On 01/05/2012 12:32 PM, Marco van de Voort wrote:
> In our previous episode, Michael Schnell said:
>> I found that the length of an "AnsiString(CP_UTF16)" is given in terms
>> of bytes and not of Words. Is this like it should ?
> Yes. Afaik that is not a sane combination, but Delphi compatible.
This really is absolutely insane, as in Delphi (I only have "Turbo"),
the length of a WideString is given in terms of word and not of bytes.
So why introducing major differences in the handling of 16 bit encoded
Strings such as
- AnsiString(CP_UTF16) (provided CP_UTF16 is previously defined to be
- UnicodeString (I can't test this)
I feel that much of the Delphi way of handling the "new string"s is
hazardous and not worth mimicking and better ways can be found - there
have been long discussions on this - (while of course for compatibility,
it is important to provide the Delphi-way behavior forced by a compiler
(BTW.: I still don't know whether Delphi even introduces the insanity
that when assigning, the auto-conversion is decided regarding the actual
internal dynamical encoding of the target or if the target's statically
given Type name is always used.)
More information about the fpc-devel