Bug #5044: Unable to enter valid dates when the (full) month contains accented letters. [r17859]
This turns out to be a codeset-setting issue, where unicode() returns different (perfectly valid) encodings of the words depending upon which codeset it's given. There's also a problem with using locale.getpreferredencoding() on OSX: It returns "mac roman", pretty much regardless of the environment locale settings. This isn't correct for recent versions of OSX under any circumstances, so this change also disables calling it on macs. svn: r17860
This commit is contained in:
parent
cfdb844725
commit
4973798c00
@ -132,7 +132,7 @@ try:
|
||||
except:
|
||||
import time
|
||||
|
||||
if constfunc.win():
|
||||
if constfunc.win() or constfunc.mac():
|
||||
codeset = locale.getlocale()[1]
|
||||
else:
|
||||
codeset = locale.getpreferredencoding()
|
||||
|
@ -260,3 +260,4 @@ def mac_setup_localization(dir, domain):
|
||||
lang = mac_resolve_locale(collation)
|
||||
if lang != None:
|
||||
os.environ["LANG"] = lang
|
||||
os.environ["LC_CTYPE"] = lang + ".UTF-8"
|
||||
|
@ -129,6 +129,9 @@ def fix_encoding(value):
|
||||
return unicode(value)
|
||||
except:
|
||||
try:
|
||||
if constfunc.mac():
|
||||
codeset = locale.getlocale()[1]
|
||||
else:
|
||||
codeset = locale.getpreferredencoding()
|
||||
except:
|
||||
codeset = "UTF-8"
|
||||
@ -308,7 +311,9 @@ def find_file( filename):
|
||||
|
||||
# Build list of alternate encodings
|
||||
encodings = set()
|
||||
|
||||
#Darwin returns "mac roman" for preferredencoding, but since it
|
||||
#returns "UTF-8" for filesystemencoding, and that's first, this
|
||||
#works.
|
||||
for enc in [sys.getfilesystemencoding, locale.getpreferredencoding]:
|
||||
try:
|
||||
encodings.add(enc)
|
||||
|
Loading…
Reference in New Issue
Block a user