Forum: Ruby-core [ruby-trunk - Bug #8822][Open] Incorrect encoding for ENV in Windows

C4e88907313843cf07f6d85ba8162120?d=identicon&s=25 "davispuh (Dāvis Mosāns)" <redmine@ruby-lang.org> (Guest)
on 2013-08-27 10:58
(Received via mailing list)
Issue #8822 has been reported by davispuh (Dāvis Mosāns).

----------------------------------------
Bug #8822: Incorrect encoding for ENV in Windows
https://bugs.ruby-lang.org/issues/8822

Author: davispuh (Dāvis Mosāns)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: ruby 2.0.0p247 (2013-06-27) [x64-mingw32]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


=begin
When reading 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|URL:https://gist.github.com/davispuh/6351158>))
(basically set environment variable outside of ruby and in ruby print it
out)

Output on ((<Ruby2.0|URL:https://gist.github.com/davispuh/6351163>)) and
on ((<Ruby1.9|URL:https://gist.github.com/davispuh/6351207>))

Seems it wasn't properly fixed in #5570
=end
C4e88907313843cf07f6d85ba8162120?d=identicon&s=25 "davispuh (Dāvis Mosāns)" <redmine@ruby-lang.org> (Guest)
on 2013-08-27 11:12
(Received via mailing list)
Issue #8822 has been updated by davispuh (Dāvis Mosāns).


In Ruby 2.0 when assigning to ENV, seems it double encodes it.
But in Ruby 1.9 it's interesting that after assigning - it shows
console's encoding, but that shouldn't be needed at all...


----------------------------------------
Bug #8822: Incorrect encoding for ENV in Windows
https://bugs.ruby-lang.org/issues/8822#change-41366

Author: davispuh (Dāvis Mosāns)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: ruby 2.0.0p247 (2013-06-27) [x64-mingw32]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


=begin
When reading 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|URL:https://gist.github.com/davispuh/6351158>))
(basically set environment variable outside of ruby and in ruby print it
out)

Output on ((<Ruby2.0|URL:https://gist.github.com/davispuh/6351163>)) and
on ((<Ruby1.9|URL:https://gist.github.com/davispuh/6351207>))

Seems it wasn't properly fixed in #5570
=end
054b5f6b8afdd5f6190bad08e46cd782?d=identicon&s=25 zzak (Zachary Scott) (Guest)
on 2013-09-03 06:11
(Received via mailing list)
Issue #8822 has been updated by zzak (Zachary Scott).

Status changed from Open to Assigned
Assignee set to cruby-windows


----------------------------------------
Bug #8822: Incorrect encoding for ENV in Windows
https://bugs.ruby-lang.org/issues/8822#change-41552

Author: davispuh (Dāvis Mosāns)
Status: Assigned
Priority: Normal
Assignee: cruby-windows
Category:
Target version:
ruby -v: ruby 2.0.0p247 (2013-06-27) [x64-mingw32]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


=begin
When reading 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|URL:https://gist.github.com/davispuh/6351158>))
(basically set environment variable outside of ruby and in ruby print it
out)

Output on ((<Ruby2.0|URL:https://gist.github.com/davispuh/6351163>)) and
on ((<Ruby1.9|URL:https://gist.github.com/davispuh/6351207>))

Seems it wasn't properly fixed in #5570
=end
8cbb39dadafaf2287a83a13ee4981ec9?d=identicon&s=25 usa (Usaku NAKAMURA) (Guest)
on 2013-09-03 12:15
(Received via mailing list)
Issue #8822 has been updated by usa (Usaku NAKAMURA).


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.
----------------------------------------
Bug #8822: Incorrect encoding for ENV in Windows
https://bugs.ruby-lang.org/issues/8822#change-41568

Author: davispuh (Dāvis Mosāns)
Status: Assigned
Priority: Normal
Assignee: cruby-windows
Category:
Target version:
ruby -v: ruby 2.0.0p247 (2013-06-27) [x64-mingw32]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


=begin
When reading 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|URL:https://gist.github.com/davispuh/6351158>))
(basically set environment variable outside of ruby and in ruby print it
out)

Output on ((<Ruby2.0|URL:https://gist.github.com/davispuh/6351163>)) and
on ((<Ruby1.9|URL:https://gist.github.com/davispuh/6351207>))

Seems it wasn't properly fixed in #5570
=end
F1d6cc2b735bfd82c8773172da2aeab9?d=identicon&s=25 Nobuyoshi Nakada (nobu)
on 2014-06-24 14:48
(Received via mailing list)
Issue #8822 has been updated by Nobuyoshi Nakada.

Description updated

----------------------------------------
Bug #8822: Incorrect encoding for ENV in Windows
https://bugs.ruby-lang.org/issues/8822#change-47370

* Author: Dāvis Mosāns
* Status: Assigned
* Priority: Normal
* Assignee: cruby-windows
* Category:
* Target version:
* ruby -v: ruby 2.0.0p247 (2013-06-27) [x64-mingw32]
* Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN
----------------------------------------
When reading `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](https://gist.github.com/davispuh/6351158)
(basically set environment variable outside of ruby and in ruby print it
out)

Output on [Ruby2.0](https://gist.github.com/davispuh/6351163) and on
[Ruby1.9](https://gist.github.com/davispuh/6351207)

Seems it wasn't properly fixed in #5570
This topic is locked and can not be replied to.