| Bug #10199 | Allow Unicode escape sequence for string literals. | ||
|---|---|---|---|
| Submitted: | 27 Apr 2005 9:17 | Modified: | 15 Dec 2010 7:26 |
| Reporter: | Paul van Rossem | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: Parser | Severity: | S4 (Feature request) |
| Version: | 5.0 | OS: | Any (Any) |
| Assigned to: | CPU Architecture: | Any | |
[15 Dec 2010 7:26]
Valeriy Kravchuk
We have public worklog for this, http://forge.mysql.com/worklog/task.php?id=3529
[18 Mar 2014 7:13]
Daniël van Eeden
The worklog can no longer be found. The closest there is now is this: mysql> SELECT X'E6B0B4'; +-----------+ | X'E6B0B4' | +-----------+ | 水 | +-----------+ 1 row in set (0.00 sec)
[2 Jun 2014 16:59]
MySQL Verification Team
Here's the new WL link: http://dev.mysql.com/worklog/task/?id=3529
[21 Apr 8:42]
neon cube
Probably the best workaround at the moment is in this Stack Overflow answer: https://stackoverflow.com/a/56792816/132540 In essence, just use `SELECT _utf32 0x6c34` If you need to use the string in a non UTF-32 context, convert it to UTF-8: `SELECT CONVERT(_utf32 0x6c34 USING utf8)` See the Stack Overflow post for more context, and thanks to Solomon Rutzky :)

Description: There is currently no way to specify a Unicode character escape sequence for use in string literals. The strange thing is that it is possible to specify that a string is to be encoded in Unicode UTF8, but it is not possible to actually use any non-latin character inside that string. How to repeat: N.A. Suggested fix: I would like to have the possibility to specify Unicode characters as is for instance possible in HTML 水 or Java "\u6c34" to allow SQL statements like: INSERT INTO myunicodetable(mycolumn) VALUES(_utf8'use the chinese character \u6c34'); It should be possible to use in any place where an SQL statement can be used, including the command line client and stored procedures.