Hello, I'm a beginner to Rails. I has a problem about unicode when I tried some example code like below:
say_controller.rb:
Hello, I'm a beginner to Rails. I has a problem about unicode when I tried some example code like below:
say_controller.rb:
I haven't sorted out all UTF-8 yet, but I've learned that you need to add this to the top of the environment.rb file:
$KCODE = 'UTF8'
Also, be sure to use Rails' Multibyte API when working with UTF8 strings. http://api.rubyonrails.org/classes/ActiveSupport/Multibyte/Chars.html
I don't know if these will solve all your needs, but it's the place to start.
Thanks Greg,
I thikn the problem is, the
@files = Dir.glob(‘*’)
got strings that is not in UTF-8 encoding, and the I tried to trade them as UTF-8. There may needs conversions.
BTW, is
$KCODE = ‘UTF8’
the same as