Skip to content

Instantly share code, notes, and snippets.

@davispuh davispuh/Ruby1.9
Created Aug 27, 2013

Embed
What would you like to do?
Ruby 1.9, ENV incorrect encoding.
N:\Projects>SET test=testing åáâäãā
N:\Projects>SET åáâäãā=testing åáâäãā
N:\Projects>ruby -v
ruby 1.9.3p448 (2013-06-27) [i386-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 å??äaā
testing �??�a�
IBM775
"testing \x86??\x84a\x83"
====================
nil
====================
testing Ć?Ć?Ć¢Ć¤Ć£Ä?
testing �?�?�������?
IBM775
"testing \x80?\x80?\x80\x96\x80\x9F\x80\x9C\x8E?"
N:\Projects>chcp 1257
Active code page: 1257
N:\Projects>ruby test.rb
====================
testing åáâäãā
UTF-8
"testing \u00E5\u00E1\u00E2\u00E4\u00E3\u0101"
====================
testing †??„a�
testing �??�a�
Windows-1257
"testing \x86??\x84a\x83"
====================
nil
====================
testing €?€?€–€�€�ˇ?
testing �?�?�������?
Windows-1257
"testing \x80?\x80?\x80\x96\x80\x9F\x80\x9C\x8E?"
N:\Projects>chcp 65001
Active code page: 65001
N:\Projects>ruby test.rb
====================
testing åáâäãā
UTF-8
"testing åáâäãā"
====================
testing �??�a�
testing �??�a�
UTF-8
"testing \x86??\x84a\x83"
====================
nil
====================
testing �?�?�������?
testing �?�?�������?
UTF-8
"testing \x80?\x80?\x80\x96\x80\x9F\x80\x9C\x8E?"
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.