- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
Rails 2.3.5、Ruby 1.8.7 和 Mysql 5.1.53
我正在加载一个 csv 文件,它有一个字段,里面有 TM 符号(商标)
Tart Deco™ - 看起来像这样
我正在尝试查找事件记录:
Influencer.find(:first,:conditions => ["author_name = ? and url_discovered = ?",author_name,site_profile_url])
Mysql::Error: 操作 '=' 的排序规则 (latin1_swedish_ci,IMPLICIT) 和 (utf8_general_ci,COERCIBLE) 的非法混合:SELECT * FROM influencers
WHERE (author_name = 'Tart Deco?' and url_discovered = 'http://www.joelnylund.com') 限制 1
在 ruby 调试器中,字符串显示为:
p 作者姓名"酸装饰\231"
我的表格编码为“utf8_general_ci”
那我该怎么办呢?如果我存储 TM,我真的不太在意,那会很好,主要是我不想让它坏掉...
最佳答案
确保您的 table 使用 uft8 字符集:
alter table `influencers` convert to character set utf8 collate utf8_general_ci;
注意:your collation (utf8_general_ci) is not your encoding (character set) - 对 MySQL 的常见误解。
关于mysql - rails mysql 编码问题/问题 - Mysql::Error: 非法混合排序规则 (latin1_swedish_ci,IMPLICIT) 和 (utf8_general_ci,COERCIBLE),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6065037/
我是一名优秀的程序员,十分优秀!