Re: How to convert UTF-8 (hex) value to Unicode Character?. Been trying for more than a week. Please help.
Posted by: Rick James
Date: July 09, 2010 07:13PM

ucs2 has 2-byte codes. You can see them with SELECT HEX(col). Please do this to show what the bytes look like. (Seeing the character does not help -- too many other things could be fiddling with it.)

utf8 uses 1- to 3-byte codes.

http://dev.mysql.com/doc/refman/5.0/en/charset-conversion.html
http://dev.mysql.com/doc/refman/5.0/en/charset-repertoire.html
http://dev.mysql.com/doc/refman/5.0/en/charset-convert.html -- as in:
mysql> select hex(convert(unhex('efbd81') using utf8));
+------------------------------------------+
| hex(convert(unhex('efbd81') using utf8)) |
+------------------------------------------+
| EFBD81                                   |
+------------------------------------------+
1 row in set (0.00 sec)

mysql> select hex(convert(unhex('efbd81') using ucs2));
+------------------------------------------+
| hex(convert(unhex('efbd81') using ucs2)) |
+------------------------------------------+
| 00EFBD81                                 |
+------------------------------------------+
1 row in set (0.00 sec)

SHOW VARIABLES LIKE 'char%';
| character_set_database   | utf8
| character_set_server     | utf8
| character_set_system     | utf8
...

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: How to convert UTF-8 (hex) value to Unicode Character?. Been trying for more than a week. Please help.
13803
July 09, 2010 07:13PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.