From: "leifcr (Leif Ringstad)" Date: 2013-12-12T20:47:02+09:00 Subject: [ruby-core:59070] [ruby-trunk - Bug #9245][Open] Kernel::system gives wrong output for utf-8 characters on windows under utf-8 console Issue #9245 has been reported by leifcr (Leif Ringstad). ---------------------------------------- Bug #9245: Kernel::system gives wrong output for utf-8 characters on windows under utf-8 console https://bugs.ruby-lang.org/issues/9245 Author: leifcr (Leif Ringstad) Status: Open Priority: Normal Assignee: cruby-windows Category: platform/windows Target version: ruby -v: ruby 2.0.0p353 (2013-11-22) [i386-mingw32] Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN Under windows console running in utf-8 mode (chcp 65001), it is expected to print utf-8 encoded characters in a script from system calls correctly. To reproduce, create a file in utf-8 format running this: --- # test.rb # encoding: UTF-8 system "echo abc������" --- output: Make sure to set utf-8 console on windows > chcp 65001 > ruby test.rb abc������������ The expected output is: abc������ Running the following on a command prompt gives the correct output: > ruby -e "system 'echo abc������'" abc������ The problem comes clear when running other Windows commands through command line parameters e.g: system("notepad.exe abc������.txt") Notepad will complain not finding the file abc������������.txt instead of abc������.txt It seems that there is an internal encoding done before running the command. -- http://bugs.ruby-lang.org/