Rails character problem

情到浓时终转凉″ 提交于 2019-12-25 04:33:30

问题


I have problems when rewriting the Danish letters in view files as Æ Ø Å and I get this error in view: Your template was not saved as valid UTF-8. I have changed the configuration file to Danish, but I still get the error.

I have seen that all of the rails files are saved as ANSI. Do I need to change all the files to UTF-8 or are there a better way?


回答1:


This question may be related to yours.

Your view files' encoding may be broken. For example, there could somehow be an UTF-8 BOM left at the beginning, but the remaining file is encoded in ANSI.

  • Try converting it explicitly.
  • if this doesn't help try another editor and saving it there.
  • Check the file contents with a hex editor to make sure no BOM is present.

Btw, if you have to convert all files from the project, you can try using a utility like iconv.



来源:https://stackoverflow.com/questions/5124120/rails-character-problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!