D
Daniel Mendler
Hi,
I have a lot of problems with string encodings in ruby 1.9. I always get
EncodingErrors because ruby mixes the default encodings. I have set LANG
and LC_ALL to a utf locale.
test.rb
-------
def encoding_sucks_hard(string)
"hello " + string
end
And then
--------
irb(main):001:0> require 'test'
=> true
irb(main):002:0> 'test'.encoding
=> #<Encoding:UTF-8>
irb(main):003:0> encoding_sucks_hard('test').encoding
=> #<Encoding:US-ASCII>
irb(main):004:0>
How can I set the default encoding?
Daniel
I have a lot of problems with string encodings in ruby 1.9. I always get
EncodingErrors because ruby mixes the default encodings. I have set LANG
and LC_ALL to a utf locale.
test.rb
-------
def encoding_sucks_hard(string)
"hello " + string
end
And then
--------
irb(main):001:0> require 'test'
=> true
irb(main):002:0> 'test'.encoding
=> #<Encoding:UTF-8>
irb(main):003:0> encoding_sucks_hard('test').encoding
=> #<Encoding:US-ASCII>
irb(main):004:0>
How can I set the default encoding?
Daniel