Encoding problems in rails on ruby 1.9.1

后端 未结 2 1490
再見小時候
再見小時候 2021-02-15 02:36

I am using rails 2.3.3 and ruby 1.9.1.

I am trying to render a view that includes a partial. In the partial i output a field of a model that is encoded in UTF8. This fai

2条回答
  •  甜味超标
    2021-02-15 03:19

    I just had this as well so I think its worth having the correct answer.

    The 2.8.1 MySql gem is not utf-8 friendly, so it sometimes will return UTF strings and lie to Rails, telling it that they are ASCII when in fact they are UTF-8. This makes things explode.

    So: you can either monkey patch or get a compatible MySql gem. See: http://gnuu.org/2009/11/06/ruby19-rails-mysql-utf8/

提交回复
热议问题