Kernel::system gives wrong output for utf-8 characters on windows under utf-8 console
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:¶
system "echo abcæøå"¶
Make sure to set utf-8 console on windows
The expected output is:
Running the following on a command prompt gives the correct output:
ruby -e "system 'echo abcæøå'"
The problem comes clear when running other Windows commands through command line parameters e.g:
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.
Updated by jeremyevans0 (Jeremy Evans) 3 months ago
- Backport deleted (
1.9.3: UNKNOWN, 2.0.0: UNKNOWN)
- Status changed from Open to Closed
This appears to be fixed as of Ruby 2.1. I was able to recreate the issue in 2.0, but not in 2.1. I also tested the latest RubyInstaller-head, and the problem is still fixed.