On 6 Jun., 21:04, "Jan M. Nelken" <Unknown.U...@Invalid.Domainwrote:
globomike wrote:
Hi,
>
I would like to gtet the unicode value of an character stored in a DB2
UTF-8 database.
>
For example:
having the german character "ä" (a with two dots above)
the Unicode value would be '00E4' and this is what I need.
Using the hex function will returen C3A4 - so I can not use it for my
needs.
>
Ken Lunde's book CJKV Information Processing (O'Reilly published it:
ISBN 1-56592-224-7) has table 4-54 which explains how to convert from
UCS2 to UTF-8 bit array.
>
Hi Jan,
thanks for that input but this is not really the SQL solution I wanted
to see -
there is no funcztion for it and also not for the binary display of
the code.
I think a UDF or Stored Proc will be the only solution -
would be nice if the code would be available for free somewhere (for
example developer works....)
Thanks
globomike
Your 00E4 UCS-2 code point (in binary 1110 0100) thus transforms to (in
binary) 110 xxxxx 10 xxxxxx:
>
110 0001110 10 0100
>
which when grouped in 4 bits /nibble is:
>
1100 0011 1010 0100
>
C 3 A 4
>
which is what your hex function is returning (correctly).
>
Jan M. Nelken