MySQL unicode文字 [英] MySQL unicode literals

查看:194
本文介绍了MySQL unicode文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将一个记录插入到具有非ASCII Unicode字符的MySQL中,但是我在一个不允许我轻松输入非ASCII字符的终端上。如何在MySQL的SQL语法中避免使用Unicode文字?

解决方案

请参阅: http://bugs.mysql.com/bug.php?id=10199
(错误#10199:允许Unicode字符串转义序列)
自2005年以来,此请求已经开放。




http://eng.kaching.com/2009/10/mysql-unicode-escape-sequences。 HTML $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ b

您还可以使用可变长度的UTF-8表示(例如,从utf-8 URL编码的值复制,例如%E2%80%98)。

  mysql>选择_utf8 x'E28098'; 
+ --- +
| '|
+ --- +


I want to insert a record into MySQL that has a non-ASCII Unicode character, but I'm on a terminal that doesn't let me easily type non-ASCII characters. How do I escape a Unicode literal in MySQL's SQL syntax?

See: http://bugs.mysql.com/bug.php?id=10199 (Bug #10199: "Allow Unicode escape sequence for string literals.") This request has been "Open" since 2005.

From http://eng.kaching.com/2009/10/mysql-unicode-escape-sequences.html though you can see the following example, which does actually seem to work, but requires you to know the actual byte-by-byte UTF8 encoding:

"You can also use the variable-length UTF-8 representation (convenient when, for example, copying from a utf-8 URL-encoded value like %E2%80%98)."

mysql> select _utf8 x'E28098';
+---+
| ‘ |
+---+

这篇关于MySQL unicode文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆