我升级了RoR 3.0.1和Ruby 1.9.2。现在我视图中的所有字符串都是ASCII-8BIT编码?
我相信我的应用程序已经设置为使用UTF 8编码。
application.rb
config.encoding = "utf-8"
database.yml
development:
adapter: mysql
encoding: utf8
我在运行
OS X
RVM rvm 1.0.16
Ruby ruby-1.9.2-p0
Rails 3.0.1
我认为编码应该是UTF-8而不是ASCII
business.desc.encoding
# ASCII-8BIT
自从1.9.x版本可以连接不同编码的字符串后,我们看到了很多像这样的错误。
<p class="description"><%= truncate(business.desc, :length => 17) %></p>
错误信息
incompatible character encodings: ASCII-8BIT and UTF-8
activesupport (3.0.1) lib/active_support/core_ext/string/output_safety.rb:74:in `concat'
activesupport (3.0.1) lib/active_support/core_ext/string/output_safety.rb:74:in `concat'
actionpack (3.0.1) lib/action_view/template/handlers/erb.rb:14:in `<<'
app/views/browse/businesses.html.erb:15:in `block in _app_views_browse_businesses_html_erb___1616718260917998189_2173630500__1134905695726531092'
app/views/browse/businesses.html.erb:3:in `each'
app/views/browse/businesses.html.erb:3:in `each_with_index'
app/views/browse/businesses.html.erb:3:in `_app_views_browse_businesses_html_erb___1616718260917998189_2173630500__1134905695726531092'
有其他人也遇到这个问题吗?使用ruby-1.9.2-p0版本是否正确?
谢谢!