Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Consider using the locale settings from the environment.

  • Loading branch information...
commit 536a07fe2eb46d41d870c6d22109a85215ec706a 1 parent c63a4ec
@hop authored
Showing with 20 additions and 0 deletions.
  1. +20 −0 suck9.py
View
20 suck9.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# python suck9.py
+# python suck9.py | less
+# LC_CTYPE='ISO8859-1' python suck9.py
+# LC_CTYPE='ISO8859-1' python suck9.py | less
+# LC_CTYPE='UTF8' python suck9.py
+# LC_CTYPE='UTF8' python suck9.py | less
+
+import sys
+import locale
+
+print 'sys.getdefaultencoding():', sys.getdefaultencoding()
+print 'sys.stdout.encoding:', sys.stdout.encoding
+
+_, enc = locale.getdefaultlocale()
+print 'locale.getdefaultlocale():', enc
+
+sys.stdout.write(u'Python \xbb Sücks!\n'.encode(enc))
+sys.stdout.flush()
+
Please sign in to comment.
Something went wrong with that request. Please try again.