special characters
Posted by: Rich Mittel
Date: June 17, 2010 09:55AM

I should have posted this in the Newbie forum:

I realize that parts of this topic may already have been addressed somewhere, but I still turn up empty on answers to my specific question: How do I insert a unicode string literal into a MySQL table directly from the command line (no PHP/Python/etc). I'm trying to work with characters that have macrons (overbars). Here's how I try to insert the character ā into a table (after doing "SET NAMES utf8", "CHARSET utf8", and "SET character_set_server = utf8"):

mysql> create table test ( t varchar(10) character set utf8 );
Query OK, 0 rows affected (0.08 sec)

mysql> insert into test values (char(257));
Query OK, 1 row affected (0.00 sec)

mysql> select * from test;
+------+
| t |
+------+
| |
+------+
1 row in set (0.00 sec)

So it shows up as a blank plus negative space. And when I try to cast it back to an integer I get:

mysql> select cast(t as signed) from test;
+-------------------+
| cast(t as signed) |
+-------------------+
| 0 |
+-------------------+
1 row in set, 1 warning (0.00 sec)

So what went in as 257 comes out strangely as 0. Please help! Btw, my xterm has no problem displaying general unicode characters.

Options: ReplyQuote


Subject
Views
Written By
Posted
special characters
4694
June 17, 2010 09:55AM
1820
June 19, 2010 12:15AM
2241
June 23, 2010 12:05AM


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.