Ruby on Rails - encoding issue

心已入冬 提交于 2020-01-06 08:06:16

问题


I am running a RoR app that pulls data from some event tables which are using utf8_general_ci as collation.

The problem is that all my pages render stuff like this:

Atat�rk Stadi Nov 02 20:00

So far I have tried: - changing the encoding within application.rb

  • adding

    <meta charset="utf-8" />
    
  • adding

    content="text/html;charset=utf-8"
    
  • all combinations of above tags with all possible relevant encodings that may apply to our content.

Document type is

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

I have also tried HTML5 and other variations.

I have not yet tried the iconv solution, would prefer not having to go down that road.

Does anyone have any idea on how to resolve this?

Thank you! N.


回答1:


do you have a encoding: utf8 in your config/database.yml file?



来源:https://stackoverflow.com/questions/13193794/ruby-on-rails-encoding-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!