Ruby 1.9 throwing javascript encoding error

邮差的信 提交于 2019-12-13 07:16:26

问题


So, I updated my Ruby to 1.9.2, followed this:

  • Make sure 'config.encoding = "utf-8"' is there in application.rb file.
  • Make sure you are using 'mysql2' gem
  • Putting '# encoding: utf-8' on top of rake file.
  • Above 'Starter::Application.initialize!' line in environment.rb file, add following two lines:
    • Encoding.default_external = Encoding::UTF_8
    • Encoding.default_internal = Encoding::UTF_8

and now all my Ruby code is working right, but my assets/javascript/application.js is loaded only with this code:

throw Error("Encoding::CompatibilityError: incompatible character encodings: ASCII-8BIT and UTF-8")

how can i define assets encoding?

ps.: i didn't try to precompile yet, this is happening on development mode


回答1:


Read the answer to this question. Sounds like it's the same issue you're looking at. It sounds like the solution is to open the .js file with a text editor and save it as UTF-8 encoding.



来源:https://stackoverflow.com/questions/9116752/ruby-1-9-throwing-javascript-encoding-error

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