MySQL mappings don't work as advertised in the documentation
I'm trying to get my MySQL table to behave like the utf8 table in example 2 from this MySQL link :
CREATE TABLE germanutf8 (c CHAR(10)) CHARACTER SET utf8 COLLATE utf8_unicode_ci;
INSERT INTO germanutf8 VALUES ('Bar'), ('Bär');
SELECT * FROM germanutf8 WHERE c = 'Bär';
According to the example, this should give:
+------+
| c |
+------+
| Bar |
| Bär |
+------+
But all I get is simple "Bär"
. Am I doing something wrong? Should I tweak my settings?
I've tried this on MySQL 5.0.45 on Mac OS X and 5.0.51a on Red Hat.
Edit: I tried to install SET NAMES 'utf8'
, but it still gives the same result. After that my variables
+--------------------------+---------------------------------------------------------------------+
| Variable_name | Value |
+--------------------------+---------------------------------------------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql-5.0.45-osx10.4-powerpc-64bit/share/mysql/charsets/ |
+--------------------------+---------------------------------------------------------------------+
source to share
Have you had any warnings regarding your INSERT?
Are you sure your MySQL client is interpreting what you are typing correctly? For example. if you are SSHing to the server and running mysql from the command line is it both the wrapper encoding and the mysql client encoding set to UTF-8?
Have you tried to run
SET NAMES 'utf8'
before running these queries?
source to share