RoR 3.0.7 UTF-8错误

时间:2011-06-06 21:32:07

标签: ruby-on-rails-3 utf-8

RoR不断纠结这个错误:

不兼容的字符编码:UTF-8和ASCII-8BIT 提取的来源(第631行):

628:     </table>
629:     </td>
630:     <td width="828" valign="top">
631:       <%=  yield %>
632:       <br />
633:     </td>
634:   </tr>

<%= yield %>如何导致此问题?

谢谢。

1 个答案:

答案 0 :(得分:0)

尝试将其添加到文件顶部:

# encoding: utf-8

并且可能确保这在您的config / application.rb中:

module Foo
  class Application < Rails::Application
    # Configure the default encoding used in templates for Ruby 1.9.
    config.encoding = "utf-8"
  end
end