“编码::无效字节序列错误"Rails 3.1.0 中发生错误 [英] "Encoding::InvalidByteSequenceError" error occurs in Rails 3.1.0
本文介绍了“编码::无效字节序列错误"Rails 3.1.0 中发生错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将 Rails 更新到 3.1.0 版,但是当我生成新的应用程序和脚手架时,它报告:
I updated Rails to version 3.1.0, but when I generate a new app and scaffold, it reports:
Encoding::InvalidByteSequenceError in Articles#index
Showing E:/blog/app/views/layouts/application.html.erb where line #6 raised:
"\xC4\xDA" followed by "\xB2\xBF" on UTF-16LE
(in E:/blog/app/assets/javascripts/articles.js.coffee)
我的环境是:
- Windows XP
- Ruby1.9.2p180
- Rails 3.1.0
项目中文件的编码为'UTF-8'.
and the encoding of the files in the project is 'UTF-8'.
推荐答案
将Gemfile.lock中execjs的版本改为1.2.4、1.2.6或1.2.8
Change the version of execjs to 1.2.4, 1.2.6 or 1.2.8 in Gemfile.lock
只有 1.2.7 会导致问题.
Only 1.2.7 will cause the problem.
希望这会有所帮助.
这篇关于“编码::无效字节序列错误"Rails 3.1.0 中发生错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文