简体   繁体   English

如何使用ruby将其他语言存储在mysql数据库中?

[英]How to store other languages in mysql database using ruby?

I want to store languages other than English in MySQL database using Ruby. 我想使用Ruby在MySQL数据库中存储英语以外的语言。 I've tried to store Hindi language characters in MySQL database, but got ActiveRecord::StatementInvalid error. 我尝试将Hindi语言字符存储在MySQL数据库中,但遇到ActiveRecord::StatementInvalid错误。 Here is the attached screenshot - 这是所附的屏幕截图-

错误截图

Please help me solve this problem. 请帮我解决这个问题。 Thanks in advance. 提前致谢。

You could run the following command on your desired table(s): 您可以在所需的表上运行以下命令:

ALTER TABLE <table_name> CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

MySQL docs on collation and character set configuration. 有关排序规则和字符集配置的MySQL文档

Hope it helps! 希望能帮助到你!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM