[fpc-devel] FPC 2.3.1 seems a mixed mess with Unicode support

Michael Schnell mschnell at lumino.de
Tue Sep 15 14:45:59 CEST 2009


Micha Nelissen wrote:
> Graeme Geldenhuys wrote:
>>   MyString := '世界您好';
>>   MyChar := MyString[1];
>>   writeln(MyChar);
>> end.
> 
> Extracting a Char from a UnicodeString? What's that supposed to do?

If "Char" is an 8-bit coded thing, for me this does not make sense
(using the [n] notation to take the n'th  byte in an utf-8, utf-16 or
Widestring information seems not very sensible). I feel the compiler
should issue a warning on that code.

If we really want a "character", MyChar would need to be a 32-Bit thing,
and (in case of UTF, the [n] notation would need to scan the Unicode
byte stream to find it, but I don't know if it's implemented in that way.)


-Michael



More information about the fpc-devel mailing list