Skip to content

Instantly share code, notes, and snippets.

@davispuh
Last active December 21, 2015 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davispuh/6351163 to your computer and use it in GitHub Desktop.
Save davispuh/6351163 to your computer and use it in GitHub Desktop.
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