ruby-on-rails-3 - 如何在 Ruby on Rails 3 中允许从右到左的语言

标签 ruby-on-rails-3 hebrew right-to-left

我有兴趣使用 Ruby on Rails 3 创建一个希伯来语网站。问题是当我将希伯来语放入我的 View 时,我被告知它不受支持,我应该添加 UTF-8。

我已经在这方面工作了一段时间,但我似乎无法找到如何做到这一点。我也在使用 Sqlite3,我也想在那里保存希伯来语字符串。

我将如何实现这一目标?

我给出的错误代码是:
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:...
编辑:

问题是我在 Notepad++ 上工作,虽然它们是 UTF-8 格式的文件,但它没有以 UTF-8 格式保存我的文件。通过更改文件格式解决。

最佳答案

您应该尝试在 .rb 的第一行添加文件如下:

# encoding: utf-8

并在您的 .erb 的第一行
<%# encoding: utf-8 %>
encoding: utf-8coding: utf-8并且是等价的。

希望这可以帮助。

关于ruby-on-rails-3 - 如何在 Ruby on Rails 3 中允许从右到左的语言,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4866977/

相关文章:

ruby - gmaps4rails 不显示 map

javascript - 在 View 中动态更改 Ruby-on-Rails 变量

c# - 文件 ReadAllLines 将外语变成乱码 (�)

php - substr 不适用于 utf8

layout - AvalonEdit:如何使其从右到左?

ruby - FactoryGirl 和 Rails 3.2 错误

ruby-on-rails - 共享主机尚不支持 Rails on Ruby 1.9.2

android - 更改字段文本的 PDFbox 字体

utf-8 - IntelliJ 希伯来语支持

android - 开发从右到左的 Android 应用程序