Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
688 views
in Technique[技术] by (71.8m points)

sql - Allow non ascii characters in MySQL database

Recently a record was inserted into my mysql database containing russian letters. The database couldn't display them properly. Is there anything I can do to allow diversity of languages on my website?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

you should take a look at utf8 encoding

can you please post what encoding is beeing used by your database, and your table? (can you post structure of your db?)

EDIT: To answer you question in your comment, basic difference is that utf8_general_ci is faster but doesn't care about some language specific comparisons. You can read more on this in the link I submitted above in my post. In fact it affects behaviour of sorting and searching.

It does matter how would you like your database to behave, all of these collations are useful in different environments. In your case I would not use utf8_bin since it only compares strings using it's binary values.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...