0

I'm trying to get my MySQL table to behave as the utf8 table in Example 2 from this MySQL Reference page:

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 yield:

+------+
| c    |
+------+
| Bar  |
| Bär  |
+------+

But all I'm getting is simple "Bär". Am I doing something wrong? Should I adjust my settings?

I've tried this on MySQL 5.0.45 on Mac OS X and on 5.0.51a on Red Hat.

Edit: I have tried setting SET NAMES 'utf8', but this still gives the same result. After doing so my variables are

+--------------------------+---------------------------------------------------------------------+
| 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/ | 
+--------------------------+---------------------------------------------------------------------+

1 Answer 1

2

Did you get any warnings on your INSERT?

Are you sure your MySQL-client interprets what you type correctly? E.g. if you are SSHing into a server, and running mysql from the command line, is both the shell encoding and the mysql client encoding set to UTF-8?

Have you tried running

SET NAMES 'utf8'

before running these queries?

Not the answer you're looking for? Browse other questions tagged or ask your own question.