Ruby on Rails以法语闪烁消息
问题描述:
使用法语的rails应用程序,但是当我在Flash消息中包含重音时,它会破坏网站。
Working on a rails app in French, however whenever i include an accent on the flash messages it breaks the site.
例如
format.html {redirect_to @message.annonce, notice:"Votre message a été envoyé"}
format.html {redirect_to @message.annonce, notice:"Votre email n'a pas pu être envoyer à cause d'une erreur."}
我的config / application.rb看起来像这样
my config/application.rb looks like this
config.i18n.default_locale = :fr
config.encoding = "utf-8"
如何做这个?
答
你应该添加编码:UTF-8
作为您的文件的第一行添加口音。
You should add # encoding: UTF-8
as the first line of your file to add accent in it.
如果这不工作,请给我们异常提高了。
If this is not working please give us the exception raised.