[fpc-devel] simple UTF tests

Sven Barth pascaldragon at googlemail.com
Fri Jan 6 12:49:58 CET 2012

Am 06.01.2012 12:03, schrieb Hans-Peter Diettrich:
> Marco van de Voort schrieb:
>> In our previous episode, Hans-Peter Diettrich said:
>>>>> With Lazarus on Linux, I did some simple tests with UTF strings.
>>>>> 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.
>>> Which Delphi version supports AnsiString(CP_UTF16)???
>>> At least XE and successors only support byte-char (AnsiChar)
>>> codepages with AnsiString and RawByteString.
>> There is a difference between Delphi accepting it and doing something
>> sane.
> What's insane in not accepting (compiling) insane source code? ;-)
>> FPC afaik also accepts and afaik also doesn't do anything sane, so
>> that is
>> compatible :-)
> What *also*?
>> Btw in this thread it was already mentioned that Delphi doesn't define
>> CP_UTF16, but one easily could define it and create the above code.
> Then tell us the Delphi version that accepts an AnsiString(1200). I
> couldn't find any :-(

Ehm... Delphi XE DOES accept AnsiString(1200) as I've written in my 
other mail. It just doesn't do anything sane with it (Length of such a 
strings seems to be always zero).


More information about the fpc-devel mailing list