简体   繁体   English

使用ruby 1.9.1p429的rails 2.3.5:不兼容的字符编码:ASCII-8BIT和UTF-8

[英]rails 2.3.5 with ruby 1.9.1p429 : incompatible character encodings: ASCII-8BIT and UTF-8

I tried the ruby hacks for utf8 (from : http://gist.github.com/273741 ) ... and I'm still getting the following error: ActionView::TemplateError (incompatible character encodings: ASCII-8BIT and UTF-8) 我尝试了utf8的ruby hack(来自: http : //gist.github.com/273741 )...,但仍然收到以下错误:ActionView :: TemplateError(不兼容的字符编码:ASCII-8BIT和UTF- 8)

What is bizarre for me is that the same content if retrieved with a post action (searching the app with an html from) it is displaying well ... however, with get (using an html link) it telling that their is character incompatibility ! 对我来说奇怪的是,如果使用后动作(使用html搜索应用程序)检索的相同内容显示得很好……但是,使用get(使用html链接)则表明它们是字符不兼容!

Do you have any idea where it comes from ? 你有什么想法吗? is there a rails/ruby patchs for this issue ? 是否有针对此问题的rails / ruby​​补丁?

Thanks, 谢谢,

I think you problem com from template encoding in UTF-8 not in ASCII, like attempts. 我认为您是使用UTF-8而不是ASCII的模板编码(例如尝试)来问题com。

In Rails 3, there are a new configuration for that : 在Rails 3中,有一个新的配置:

# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Rails 2.3.5,Ruby 1.9,SQLite 3不兼容的字符编码:UTF-8和ASCII-8BIT - Rails 2.3.5, Ruby 1.9, SQLite 3 incompatible character encodings: UTF-8 and ASCII-8BIT 不兼容的字符编码:Ruby 1.9中的ASCII-8BIT和UTF-8 - incompatible character encodings: ASCII-8BIT and UTF-8 in Ruby 1.9 Ruby异常:`不兼容的字符编码:ASCII-8BIT和UTF-8` - Ruby exception: `incompatible character encodings: ASCII-8BIT and UTF-8` Rails不兼容的字符编码:UTF-8和ASCII-8BIT - Rails incompatible character encodings: UTF-8 and ASCII-8BIT Rails 4:不兼容的字符编码:UTF-8和ASCII-8BIT - Rails 4: incompatible character encodings: UTF-8 and ASCII-8BIT rails不兼容的字符编码:json中的UTF-8和ASCII-8BIT - rails incompatible character encodings: UTF-8 and ASCII-8BIT in json Rails:geokit“不兼容的字符编码:UTF-8和ASCII-8BIT” - Rails: geokit “incompatible character encodings: UTF-8 and ASCII-8BIT ” Rails 3.1.0:不兼容的字符编码:ASCII-8BIT和UTF-8 - Rails 3.1.0: incompatible character encodings: ASCII-8BIT and UTF-8 Ruby on Rails 3,不兼容的字符编码:带有i18n的UTF-8和ASCII-8BIT - Ruby on Rails 3, incompatible character encodings: UTF-8 and ASCII-8BIT with i18n Rails 2.3 + Ruby 1.8.7不兼容的字符编码:UTF-8和ASCII-8BIT - Rails 2.3 + Ruby 1.8.7 incompatible character encodings: UTF-8 and ASCII-8BIT
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM