If you're using MySQL 5.5.3 or later I would set your character set to utf8mb4
MySQL: Table name with UTF characters
Question
I'm having a hard time creating a table in MySQL with UTF characters. I am completely lost on how to solve this one.
There's only two special characters in this particular table name:
- 1F4D2 📒 LEDGER (http://www.unicode.org/charts/PDF/U1F300.pdf)
- 274E ❎ NEGATIVE SQUARED CROSS MARK (http://www.unicode.org/charts/PDF/U2700.pdf)
Code:
CREATE TABLE `📒_❎` (id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT);
Message:
Invalid utf8 character string: '📒_❎'
This works, however:
SELECT _utf8'📒_❎'
Solution 2
OTHER TIPS
Take a look at the following page: http://dev.mysql.com/doc/refman/5.1/en/identifiers.html
The problematic char is 1F4D2
, as the documentation states:
Permitted characters in quoted identifiers include the full Unicode Basic Multilingual Plane (BMP), except U+0000:
ASCII: U+0001 .. U+007F
Extended: U+0080 .. U+FFFF
ASCII NUL (U+0000) and supplementary characters (U+10000 and higher) are not permitted in quoted or unquoted identifiers.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow