Created
March 21, 2012 10:47
-
-
Save japsu/2146116 to your computer and use it in GitHub Desktop.
Python stdout weirdness
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
japsu@eris ~ $ cat foo.py | |
#!/usr/bin/env python | |
# encoding: utf-8 | |
import sys | |
sys.stdout.write(u"åöä\n") | |
japsu@eris ~ $ python foo.py | |
åöä | |
japsu@eris ~ $ python foo.py | cat | |
Traceback (most recent call last): | |
File "foo.py", line 5, in <module> | |
sys.stdout.write(u"åöä\n") | |
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment