如何存储非英语字符? [英] How to store non-english characters?
问题描述
非英语字符在文本列中被弄乱了.阿拉伯文字如下:
Non-english characters are messed up in a text column. Arabic text looks like this:
نـجـمسـهـيـل
نـجـم سـهـيـل
如何正确存储非英语字符?
How to store non-english characters correctly?
推荐答案
您应该考虑使用 utf8 存储文本.
You should consider using utf8 to store your text.
您可以在创建数据库时执行以下操作:
You can do this at the database creation:
CREATE DATABASE mydb
DEFAULT CHARACTER SET utf8
DEFAULT COLLATE utf8_general_ci;
您还可以在安装或启动时将mysql配置为使用utf8(请参见
You can also configure mysql at installation or at startup to use utf8 (see Mysql manual)
mysql手册页涵盖了字符集和排序规则的所有方面: http: //dev.mysql.com/doc/refman/5.0/zh-CN/charset.html
The mysql manual pages cover all aspects of characterset and collations: http://dev.mysql.com/doc/refman/5.0/en/charset.html
可以通过以下方式更改连接的字符集
The character set of the connection can be changed by
SET CHARACTER SET utf8
More details here and in the chapter Character set support
这篇关于如何存储非英语字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!