Incorrect encoding for ENV in Windows
|ruby -v:||ruby 2.0.0p247 (2013-06-27) [x64-mingw32]||Backport:||1.9.3: UNKNOWN, 2.0.0: UNKNOWN|
ENV and if it contains non-ASCII - string won't have correct encoding.
In Ruby 2.0 we can force it to UTF8 (it doesn't matter what's windows encoding nor consoles) and it will be correct, but in Ruby 1.9 there's no way to correctly read it.
Writing non-ASCII string to ENV is not possible at all neither of versions.
Also Ruby1.9 fails to read ENV with name witch contains non-ASCII
Here's test.rb script (basically set environment variable outside of ruby and in ruby print it out)
Seems it wasn't properly fixed in #5570
#3 Updated by Usaku NAKAMURA almost 2 years ago
Since Ruby 1.8 assumes the encoding of ENV is locale (or -K specified encoding),
Ruby 1.9 also treats it as locale for compatibility.
It was intentional decision, not bug.
We were able to break compatibility at Ruby 2.0, but the work was not done.
BTW, to be sure, the present behavior of Ruby 2.0 is wrong.
It should be corrected.