Quote from http://www.unicode.org/faq/programming.html

"Many libraries, such as ICU or Java 5, use a hybrid approach. For
strings, they use UTF-16 to reduce storage, but for single-character
APIs they use code points (UTF-32 values) for API simplicity."

It makes sense, instead of doing operations like:

if UTF8Key = SomeUTF8KeyString then
  DoSomething
else if UTF8Key = SomeOtherUTF8KeyString then
.
.
.

Convert UTF8 Key string to UTF32 Char and do:

case UTF32Key of
  SomeUTF32Key:;
  SomeOtherUTF32Key:;
.
.
.
end;

The second code will not be faster because of the conversion but the
code will be nicer and comparing integers is probably better than
comparing strings.
Also i don't understand why TUTF8Char = String[7]; instead of
string[6] since UTF8 has 6 bytes or am i wrong ?

Btw where are Key string constants for UTF8 defined or Key Values UTF32, UCS-2 ?

Razvan

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to