How can I avoid putting the magic encoding comment on top of every UTF-8 file in Ruby 1.9?

后端 未结 7 2120
野的像风
野的像风 2020-12-13 18:30

I have a Rails project with a lot of Cyrillic strings in it.

It worked fine on Ruby 1.8, but Ruby 1.9 assumes source files are US-ASCII-encoded unless you provide a

7条回答
  •  醉酒成梦
    2020-12-13 19:10

    I don't run into this much, but when I need to ensure UTF-8, I use the $KCODE global. Try putting this in your environment.rb: $KCODE = 'UTF8'

    Also, are you certain that your editor is saving files in UTF-8?

提交回复
热议问题