Created
September 25, 2010 10:07
-
-
Save disolovyov/596695 to your computer and use it in GitHub Desktop.
Sync terminal IO encoding with script encoding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
verbose = $VERBOSE | |
$VERBOSE = nil | |
Encoding.default_external = Encoding.find(Encoding.locale_charmap) | |
Encoding.default_internal = __ENCODING__ | |
$VERBOSE = verbose | |
[STDIN, STDOUT, STDERR].each do |io| | |
io.set_encoding(Encoding.default_external, Encoding.default_internal) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment