I use a Python program to write text containing Unicode characters to a
MySQL
database. As an example, two of the characters are
u'\u2640' a symbol for Venus or female
u'\u2642' a symbol for Mars or male
I use utf8mb4 for virtually all character sets involved with MySQL. Here is
an excerpt from /etc/mysql/my.cnf
[client]
default-character-set=utf8mb4
[mysql]
default-character-set=utf8mb4
[mysqld]
character-set-server =utf8mb4
I'm not sure that the [client] option does anything, but it doesn't seem to
hurt.
In addition, all tables are created with these parameters:
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
In all respects except one, the treatment of Unicode works just fine. I can
write Unicode to database tables, read it, display it, etc., with no
problems. The exception is mysql, the MySQL Command-Line Tool. When I
execute a SELECT statement to see rows in a table containing the Venus and
Mars Unicode characters, here is what I see on the screen:
| Venus | ♀ |
| Mars | ♂ |
What I want to see is this
| Venus | ♀ |
| Mars | ♂ |
I get the same behavior with the MySQL Command Line Tool when I run it on
Windows, Mac OS X, and Ubuntu, so I'm pretty sure the problem has to do
with
mysql itself.
Any ideas about how to get the MySQL Command-Line Tool to display Unicode
properly?
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql