1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #10335: handle system locals unknown to Python in timezone name handling. Thanks, mitsuhiko.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10703 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss
2009-05-08 09:51:05 +00:00
parent 59507753c7
commit 60cfd45107
2 changed files with 15 additions and 10 deletions

View File

@@ -1,6 +1,8 @@
import types
import urllib
import locale
import datetime
import codecs
from django.utils.functional import Promise
@@ -136,3 +138,12 @@ def iri_to_uri(iri):
return iri
return urllib.quote(smart_str(iri), safe='/#%[]=:;$&()+,!?*')
# The encoding of the default system locale but falls back to the
# given fallback encoding if the encoding is unsupported by python or could
# not be determined. See tickets #10335 and #5846
try:
DEFAULT_LOCALE_ENCODING = locale.getdefaultlocale()[1] or 'ascii'
codecs.lookup(DEFAULT_LOCALE_ENCODING)
except:
DEFAULT_LOCALE_ENCODING = 'ascii'