我有这段代码可以咨询:
text = 'pestañas'
text.split(' ').each do |word|
@dictionary = Dictionary.where('spanish_word LIKE ?', "%#{word}%").first
end
但如果我在调试器上看到,我有这个咨询:
Dictionary Load (0.3ms) SELECT `dictionaries`.* FROM `dictionaries` WHERE (spanish_word LIKE '%pestaas%') LIMIT 1
我有ñ,á,é,í,ó,ú或拉丁字符这个问题。我的MySQL数据库编码是UTF-8 Unicode(utf8),Ruby 1.9.2p0