rails的字符编码
想练练手,随意的写了个登陆页面,简单的只有几行。
<%= form_tag('login_check') do -%><%= text_field_tag 'user_name', 'Enter your search query here' %><br><%= password_field_tag 'user_password' %><br><%= submit_tag '登录' %><%= button_tag '清空' %><% end -%>
却发现,报错了,页面显示
We're sorry, but something went wrong.
If you are the application owner check the logs for more information.
在日志中查看到:
ActionView::Template::Error (Your template was not saved as valid UTF-8. Please either specify UTF-8 as the encoding for your template in your text editor, or mark the template with its encoding by inserting the following as the first line of the template:
# encoding: <name of correct encoding>.
了解到是因为字符编码的问题