What have you found for these years?

2011-05-24

Heroku locale

I forgot if I had mentioned this before, but since I got trapped again,
I should memo this once again.

By default, the locale on Heroku is `POSIX`, which is fine,
but in Ruby 1.9.2, this would affect `Encoding.default_external`,
and which would make Rails break for UTF-8 strings somehow.

So I have set LC_ALL to en_US.UTF-8 on some apps:

heroku config:add LC_ALL=en_US.UTF-8
and forgot to set it on other machines.

The other way, we can simply set Encoding.default_external = 'utf-8'
somewhere in the program (e.g. Gemfile), so that we're not relying on
locale.

Also, favor psych in 1.9.2 would be good. Put this in Gemfile:
begin
  require 'psych'
  YAML::ENGINE.yamler = 'psych'
rescue LoadError
end

ok, I think I have said it here:
1930. 04-25 Ruby gotcha from 1.8 to 1.9

0 retries:

Post a Comment

All texts are licensed under CC Attribution 3.0