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:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user