Created
March 10, 2015 14:05
-
-
Save zhester/2d9f5699bd87466d7496 to your computer and use it in GitHub Desktop.
Python boilerplate to encode strings sent to stdout as UTF-8
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
# write UTF-8 to stdout | |
if sys.stdout.encoding != 'UTF-8': | |
import codecs | |
writer = codecs.getwriter( 'UTF-8' ) | |
sys.stdout = writer( sys.stdout ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment