【发布时间】:2012-02-24 09:04:04
【问题描述】:
我刚开始使用亮丽的 Rails 新版本 3.2.1 开发一个新的 Rails 应用程序。以前,我只使用了 3.0.9 版本。在我描述我的错误之前,让我们知道我在 Windows 7 32 位上使用 Ruby 版本 ruby 1.9.2p290 (2011-07-09) [i386-mingw32]。我最近没有更改我的 Ruby 版本。我正在使用 Notepad++ v5.9.3 并且没有(故意)更改任何默认设置。
当我第一次运行我的新应用时,我收到一条奇怪的消息:
ActionView::WrongEncodingError in Index#index
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>.
我不明白为什么我会突然收到这个错误。它是对 Rails 3.2.1 所做更改的一部分吗?通过进入 Notepad++ 并使用编码菜单选项“转换为 UTF-8”很容易修复它,但是,就像我说的,我以前从来没有这样做过。
另一个奇怪的事情是,当我使用生成器时,即使是 Rails 生成的文件也是使用 ANSI 编码生成的。总的来说,我很困惑,我想确保我正在使用良好的编程实践。
【问题讨论】:
标签: ruby-on-rails utf-8