Commit a9170c7e authored by Martin v. Löwis's avatar Martin v. Löwis

Patch #808719: Ignore the locale's encoding if it is an empty string.

Backported to 2.3.
parent 68ba9a68
......@@ -48,7 +48,7 @@ else:
# resulting codeset may be unknown to Python. We ignore all
# these problems, falling back to ASCII
encoding = locale.nl_langinfo(locale.CODESET)
if encoding is None:
if encoding is None or encoding is '':
# situation occurs on Mac OS X
encoding = 'ascii'
codecs.lookup(encoding)
......@@ -58,7 +58,7 @@ else:
# bugs that can cause ValueError.
try:
encoding = locale.getdefaultlocale()[1]
if encoding is None:
if encoding is None or encoding is '':
# situation occurs on Mac OS X
encoding = 'ascii'
codecs.lookup(encoding)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment