[ruby-core:67951] [ruby-trunk - Bug #10493] Wrong encoding for Etc.getlogin in Windows

From: nagachika00@...
Date: 2015-02-02 14:01:00 UTC
List: ruby-core #67951
Issue #10493 has been updated by Tomoyuki Chikanaga.

Backport changed from 2.0.0: DONE, 2.1: REQUIRED to 2.0.0: DONE, 2.1: DONE

Backported into `ruby_2_1` at r49473.

usa-san, thank you for your advice. I'll keep my eyes on RubyCI, especially=
 on vc-x64.

----------------------------------------
Bug #10493: Wrong encoding for Etc.getlogin in Windows
https://bugs.ruby-lang.org/issues/10493#change-51338

* Author: D=C4=81vis Mos=C4=81ns
* Status: Closed
* Priority: Normal
* Assignee:=20
* ruby -v: ruby 2.1.4p265 (2014-10-27 revision 48166) [x64-mingw32]
* Backport: 2.0.0: DONE, 2.1: DONE
----------------------------------------

~~~ruby
name =3D Etc.getlogin # I've Windows username "D=C4=81vis"
puts name           # D=EF=BF=BDvis
puts name.inspect   # "D\xE2vis"
puts name.encoding  # ASCII-8BIT
name.force_encoding('Windows-1257')
puts name           # D=C4=81vis
~~~

As you can see \xE2 isn't "=C4=81" in ASCII, but it is for Windws-1257 enco=
ding.






--=20
https://bugs.ruby-lang.org/

In This Thread

Prev Next