Encoding issues in browser but NOT in rails console
Another Rails 3 encoding issue for ya'll.
I have this code in a controller:
@page_title = @episode.podcast.name + " » " + @episode.title.force_encoding("utf-8").truncate(25)
When I load the page in the browser I get this error:
**incompatible character encodings: ASCII-8BIT and UTF-8**
However, when I run the same code in rails console, I get this:
"Jenner y Balmís, médic..."
My limited knowledge tells me this开发者_StackOverflow is related to a configuration or environmental issue.
Are you specifying the characterset in a meta tag in your layout? This is one from a multilingual project I did. Its using HAML but you get the idea:
%meta{ :"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8" }
精彩评论