Re: Searching/inserting certain Unicode characters
Posted by: Peter Gulutzan
Date: February 17, 2011 06:34PM

You have a UTF8 column, so first you have to know
what the UTF8 encoding is for U+00A0. You can look
it up, or you can do the conversion in SQL, e.g.

mysql> select hex(cast(_ucs2 0x00a0 as char character set utf8));
+----------------------------------------------------+
| hex(cast(_ucs2 0x00a0 as char character set utf8)) |
+----------------------------------------------------+
| C2A0 |
+----------------------------------------------------+
1 row in set (0.00 sec)

And to insert that, you just precede it with '0x', e.g.

mysql> create table table_name (utf8 char(5) character set utf8);
Query OK, 0 rows affected (0.04 sec)

mysql> INSERT INTO table_name VALUES (0xC2A0);
Query OK, 1 row affected (0.00 sec)

mysql> SELECT hex(utf8) FROM table_name WHERE utf8 = 0xC2A0;
+-----------+
| hex(utf8) |
+-----------+
| C2A0 |
+-----------+
1 row in set (0.00 sec)



Peter Gulutzan
MySQL / Oracle

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Searching/inserting certain Unicode characters
4394
February 17, 2011 06:34PM


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.