-
-
Save mashiro/364414 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/usr/bin/env python | |
| # -*- encoding: utf-8 -*- | |
| import sys | |
| import codecs | |
| encoding = sys.getfilesystemencoding() | |
| sys.stdin = codecs.getreader(encoding)(sys.stdin) | |
| sys.stdout = codecs.getwriter(encoding)(sys.stdout) | |
| print 'encoding: %s' % encoding | |
| str = sys.stdin.readline() | |
| print type(str) # unicode | |
| print str | |
| str = u'はうはう' | |
| print type(str) # unicode | |
| print str |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment