mirror of
https://github.com/python/cpython.git
synced 2025-11-28 22:18:54 +00:00
Patch #808719: Ignore the locale's encoding if it is an empty string.
Backported to 2.3.
This commit is contained in:
parent
68ba9a685d
commit
a9170c7eac
1 changed files with 2 additions and 2 deletions
|
|
@ -48,7 +48,7 @@ else:
|
||||||
# resulting codeset may be unknown to Python. We ignore all
|
# resulting codeset may be unknown to Python. We ignore all
|
||||||
# these problems, falling back to ASCII
|
# these problems, falling back to ASCII
|
||||||
encoding = locale.nl_langinfo(locale.CODESET)
|
encoding = locale.nl_langinfo(locale.CODESET)
|
||||||
if encoding is None:
|
if encoding is None or encoding is '':
|
||||||
# situation occurs on Mac OS X
|
# situation occurs on Mac OS X
|
||||||
encoding = 'ascii'
|
encoding = 'ascii'
|
||||||
codecs.lookup(encoding)
|
codecs.lookup(encoding)
|
||||||
|
|
@ -58,7 +58,7 @@ else:
|
||||||
# bugs that can cause ValueError.
|
# bugs that can cause ValueError.
|
||||||
try:
|
try:
|
||||||
encoding = locale.getdefaultlocale()[1]
|
encoding = locale.getdefaultlocale()[1]
|
||||||
if encoding is None:
|
if encoding is None or encoding is '':
|
||||||
# situation occurs on Mac OS X
|
# situation occurs on Mac OS X
|
||||||
encoding = 'ascii'
|
encoding = 'ascii'
|
||||||
codecs.lookup(encoding)
|
codecs.lookup(encoding)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue