Skip to content

Instantly share code, notes, and snippets.

@davispuh davispuh/Ruby2.0
Last active Dec 21, 2015

Embed
What would you like to do?
Ruby 2.0, ENV incorrect encoding.
N:\Projects>SET test=testing åáâäãā
N:\Projects>SET åáâäãā=testing åáâäãā
N:\Projects>ruby -v
ruby 2.0.0p247 (2013-06-27) [x64-mingw32]
N:\Projects>chcp 775
Active code page: 775
N:\Projects>ruby test.rb
====================
testing åáâäãā
UTF-8
"testing \u00E5\u00E1\u00E2\u00E4\u00E3\u0101"
====================
testing ������������
testing åáâäãā
ASCII-8BIT
"testing \xC3\xA5\xC3\xA1\xC3\xA2\xC3\xA4\xC3\xA3\xC4\x81"
====================
testing ������������
testing åáâäãā
ASCII-8BIT
"testing \xC3\xA5\xC3\xA1\xC3\xA2\xC3\xA4\xC3\xA3\xC4\x81"
====================
testing ��������������������������
testing ĆĆĆ¢Ć¤Ć£Ä
ASCII-8BIT
"testing \xC4\x86\xEF\xA3\xBD\xC4\x86\xEF\xA3\xBC\xC4\x86\xC2\xA2\xC4\x86\xC2\xA4\xC4\x86\xC2\xA3\xC3\x84\xC2\x81"
N:\Projects>chcp 1257
Active code page: 1257
N:\Projects>ruby test.rb
====================
testing åáâäãā
UTF-8
"testing \u00E5\u00E1\u00E2\u00E4\u00E3\u0101"
====================
testing ������������
testing åáâäãā
ASCII-8BIT
"testing \xC3\xA5\xC3\xA1\xC3\xA2\xC3\xA4\xC3\xA3\xC4\x81"
====================
testing ������������
testing åáâäãā
ASCII-8BIT
"testing \xC3\xA5\xC3\xA1\xC3\xA2\xC3\xA4\xC3\xA3\xC4\x81"
====================
testing ��������������������������
testing ĆĆĆ¢Ć¤Ć£Ä
ASCII-8BIT
"testing \xC4\x86\xEF\xA3\xBD\xC4\x86\xEF\xA3\xBC\xC4\x86\xC2\xA2\xC4\x86\xC2\xA4\xC4\x86\xC2\xA3\xC3\x84\xC2\x81"
N:\Projects>chcp 65001
Active code page: 65001
N:\Projects>ruby test.rb
====================
testing åáâäãā
UTF-8
"testing åáâäãā"
====================
testing ������������
testing åáâäãā
ASCII-8BIT
"testing \xC3\xA5\xC3\xA1\xC3\xA2\xC3\xA4\xC3\xA3\xC4\x81"
====================
testing ������������
testing åáâäãā
ASCII-8BIT
"testing \xC3\xA5\xC3\xA1\xC3\xA2\xC3\xA4\xC3\xA3\xC4\x81"
====================
testing ��������������������������
testing ĆĆĆ¢Ć¤Ć£Ä
ASCII-8BIT
"testing \xC4\x86\xEF\xA3\xBD\xC4\x86\xEF\xA3\xBC\xC4\x86\xC2\xA2\xC4\x86\xC2\xA4\xC4\x86\xC2\xA3\xC3\x84\xC2\x81"
N:\Projects>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.