[fpc-devel] Unicode support (yet again)

Hans-Peter Diettrich DrDiettrich1 at aol.com
Thu Sep 15 20:10:01 CEST 2011


cobines schrieb:
> 2011/9/15 Michael Schnell <mschnell at lumino.de>:
>> In fact users want to deal with "decently coded characters" and not with
>> "cryptic bytes some of which together are representing a character". (e.g.
>> when doing MyChar := MyString[1]; )
> 
> I think of Unicode text as a stream of Unicode characters in some
> format. I trust that functions that deal with the string Copy, Length,
> Find, etc., know how to handle it.

Right.

> When doing:
> MyChar := MyString[1]
> 
> appropriate function retrieves first unicode character, regardless of encoding.

This is just wrong :-(

MyString[1] accesses the first element of the *physical* character 
array, regardless of any encoding. Also Length returns the array size, 
not the number of *logical* characters in it.

> Whether it's utf8, utf16, utf32 or any other future encoding the code
> should work the same.

Very new functions are required for dealing with *logical* characters, 
in every MBCS encoding.

DoDi




More information about the fpc-devel mailing list