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