Actions
Bug #9245
closedKernel::system gives wrong output for utf-8 characters on windows under utf-8 console
Description
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.
Actions
Like0
Like0