views:

46

answers:

0

I converted a kanji column in my database to UCS-2 codes with this, it works:

SELECT hex(convert('二' using ucs2));

=> 0x4E8C  aka  &#x4E8C  aka  Unicode Code Point 20108

But if I want to convert my SQL results back to kanji, I get the wrong character:

SELECT CHAR(0x4E8C USING ucs2);

Returns

丁   which has code point 0x4E01

Instead of the Japanese character "shi" which means "two":

I'm trying to get Japanese kanji to display correctly in MySQL Workbench results, but it returns Chinese characters (other characters clearly display a chinese variant, with simplified forms). I thought this may be a font problem (some chinese and japanese characters overlap in the unicode range, which have very similar appearance), but this is plainly a different character, and strangely '丁' is also NOT the chinese character for two.

Can I hint at MySQL somehow that the UCS-2 code given is for Japanese instead of Chinese?

How can I get the correct character with CHAR() ?

Edit:

This code

SELECT charset(CHAR(0x4E8C USING ucs2));

=> ucs2     OK

SELECT HEX(CHAR(0x4E8C USING ucs2));

=> 4E01     *cry*

Also gives me '4E01' instead of '4E8C' .. on Terminal, MySQLWorkbench, and through telnet SSH on the web host... :(