[Lazarus] Ord of a UTF8 char
Michael Schnell
mschnell at lumino.de
Mon Mar 29 09:04:29 CEST 2010
On 03/27/2010 06:05 AM, Antônio wrote:
> Ord('a') makes sense to the compiler, Ord('á') does not. Why?
>
In the Unicode world a non-ASCII-character is not an 8 bit entity. So,
with the current compiler version, (unexpectedly) a single quoted
non-ASCII character is an UTF-8 coded string, while a single quoted
ASCII character is a character. (I feel this might change with a future
compiler version when D2010 strings might be introduced).
Unless you want to use the old style (depreciated) locale-dependent 8
bit ANSI encoding you could enumerate characters as 16 (or even 32 Bit)
Unicode numbers. AFAIK appropriate conversion functions are available in
the RTL.
-Michael
More information about the Lazarus
mailing list