Project

General

Profile

Actions

Bug #10493

closed

Wrong encoding for Etc.getlogin in Windows

Added by davispuh (Dāvis Mosāns) almost 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
ruby -v:
ruby 2.1.4p265 (2014-10-27 revision 48166) [x64-mingw32]
[ruby-core:66163]

Description

name = Etc.getlogin # I've Windows username "Dāvis"
puts name           # D�vis
puts name.inspect   # "D\xE2vis"
puts name.encoding  # ASCII-8BIT
name.force_encoding('Windows-1257')
puts name           # Dāvis

As you can see \xE2 isn't "ā" in ASCII, but it is for Windws-1257 encoding.

Actions

Also available in: Atom PDF