summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorFredrik Lundh <fredrik@pythonware.com>2000-07-15 20:45:23 (GMT)
committerFredrik Lundh <fredrik@pythonware.com>2000-07-15 20:45:23 (GMT)
commit47ac12662a11174c18400cfdf08ad50f97e3d2cd (patch)
tree54f66c80ffdc5053c55bf343c2e3da70f4b301f3 /Lib
parent467a67e74d9ead0440cffb58d5fc299e477b26f0 (diff)
downloadcpython-47ac12662a11174c18400cfdf08ad50f97e3d2cd.zip
cpython-47ac12662a11174c18400cfdf08ad50f97e3d2cd.tar.gz
cpython-47ac12662a11174c18400cfdf08ad50f97e3d2cd.tar.bz2
-- changed default encoding to "ascii". you can still change
the default via site.py...
Diffstat (limited to 'Lib')
-rw-r--r--Lib/site.py30
1 files changed, 13 insertions, 17 deletions
diff --git a/Lib/site.py b/Lib/site.py
index 17f253a..14d9b04 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -123,27 +123,23 @@ del exit
# Set the string encoding used by the Unicode implementation to the
# encoding used by the default locale of this system. If the default
# encoding cannot be determined or is unknown, it defaults to 'ascii'.
-#
-def locale_aware_defaultencoding():
- import locale
- code, encoding = locale.getdefaultlocale()
- if encoding is None:
- encoding = 'ascii'
- try:
- sys.setdefaultencoding(encoding)
- except LookupError:
- sys.setdefaultencoding('ascii')
-if 1:
+encoding = None # default
+
+if 0:
# Enable to support locale aware default string encodings.
- locale_aware_defaultencoding()
-elif 0:
+ import locale
+ loc = locale.getdefaultlocale()
+ if loc[1]:
+ encoding = loc[1]
+
+if 0:
# Enable to switch off string to Unicode coercion and implicit
# Unicode to string conversion.
- sys.setdefaultencoding('undefined')
-elif 0:
- # Enable to hard-code a site specific default string encoding.
- sys.setdefaultencoding('ascii')
+ encoding = "undefined"
+
+if not encoding:
+ encoding = "ascii"
#
# Run custom site specific code, if available.