[fpc-devel] Unicode support (again)

Michael Schnell mschnell at lumino.de
Tue Nov 11 09:27:02 CET 2008


>
> IMHO, this is working fine. 

(Thanks for pointing out that there in fact _are_ (slow) function that 
can manually called to do this with UTF8Strings.)

I don't doubt that it is working fine, but the usual Pascal programmer 
does not "expect" that (s)he manually needs to call a special function 
to extract a character from a string ( (s)he is used to just do s[i]) 
and that (s)he needs to do something other than just "length()" to find 
out the count of characters in a string. (S)He "expects" that the 
compiler can handle this as it does have the type UTF8String that tells 
it about the coding of the information. The compiler instead just 
ignores this information. (Other than C, Pascal is more largely supposed 
to use the operant type for defining the kind of an operation. E.g. in C 
you do "&" for "bitwise and", and "&&" for "boolean and", while with 
Pascal you always do "and", while the type (integer vs boolean) decides 
what kind of operation is to be done. Similarly, you do "+" for integer 
and for String with completely different operations. That is why I think 
you are allowed to suppose that the compiler knows how to differently 
handle ANIString and UTF8String. )

I am aware that there _are_ (speed-) reasons that suggest not to ´work 
with character-counted (instead of subcode-counted) unicode strings. But 
I would rather work with UCS2 codes WideStrings (trading memory for 
speed) in that case.


-Michael



More information about the fpc-devel mailing list