Bug #877: [win32] Ruby Standard Library (maybe smth else): Wrong Encoding in Files, Directories and Environment Variables
http://redmine.ruby-lang.org/issues/show/877

Author: Dmitry A. Ustalov
Status: Open, Priority: High
Target version: Ruby 1.8.6

I am from Russia, and my system language is set to Russian.

When I tried to create a directory via Dir.mkdir method:

irb(main):002:0> Dir.mkdir "c:/ruby/扭把抉志快把抗忘"
=> 0

Word "扭把抉志快把抗忘" means "test" in Russian.

Directory name appears in wrong charset (details at the
screenshot).

irb(main):003:0> File.exists? "c:/ruby/扭把抉志快把抗忘"
=> true

This is a root of many problems, for example, when program
tries to create a directory in %USERPROFILE%/Application Data, see:

Microsoft Windows XP [圾快把扼我攸 5.1.2600]
(妊) 妞抉把扭抉把忘扯我攸 妙忘抄抗把抉扼抉扳找, 1985-2001.

C:\Documents and Settings\均忱技我扶我扼找把忘找抉把>irb
irb(main):001:0> $KCODE = 'utf8'
=> "utf8"
irb(main):002:0> ENV['userprofile']
=> "C:\\Documents and Settings\\\200\244\254\250\255\250扼找把\240找抉把"
irb(main):003:0> $KCODE = ''
=> ""
irb(main):004:0> ENV['userprofile']
=> "C:\\Documents and Settings\\\200\244\254\250\255\250\341\342\340\240\342\256
\340"
irb(main):005:0> File.exists? ENV['userprofile']
=> false

Word "均忱技我扶我扼找把忘找抉把" means "Administrator" in Russian.

Microsoft Windows XP [Version 5.1.2600].

C:\>ruby -v
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]

Ruby is installed from http://rubyinstaller.rubyforge.org/ .


----------------------------------------
http://redmine.ruby-lang.org