#10428: django.utils.dateformat: unknown encoding: gbk2312
----------------------------------+-----------------------------------------
Reporter: anonymous | Owner: nobody
Status: new | Milestone:
Component: Internationalization | Version: 1.0
Keywords: | Stage: Unreviewed
Has_patch: 0 |
----------------------------------+-----------------------------------------
when the system locale is set to "zh_CN.GBK2312", following error pop up
when using DateFormat to format a datetime:
{{{
Original Traceback (most recent call last):
File "/usr/lib/python2.3/site-packages/django/template/debug.py", line
71, in render_node
result = node.render(context)
File "/usr/lib/python2.3/site-packages/django/template/debug.py", line
87, in render
output = force_unicode(self.filter_expression.resolve(context))
File "/usr/lib/python2.3/site-packages/django/template/__init__.py",
line 559, in resolve
new_obj = func(obj, *arg_vals)
File "/usr/lib/python2.3/site-
packages/django/template/defaultfilters.py", line 668, in date
return format(value, arg)
File "/usr/lib/python2.3/site-packages/django/utils/dateformat.py", line
263, in format
df = DateFormat(value)
File "/usr/lib/python2.3/site-packages/django/utils/dateformat.py", line
114, in __init__
self.timezone = LocalTimezone(dt)
File "/usr/lib/python2.3/site-packages/django/utils/tzinfo.py", line 41,
in __init__
self._tzname = self.tzname(dt)
File "/usr/lib/python2.3/site-packages/django/utils/tzinfo.py", line 60,
in tzname
return smart_unicode(time.tzname[self._isdst(dt)], DEFAULT_ENCODING)
File "/usr/lib/python2.3/site-packages/django/utils/encoding.py", line
35, in smart_unicode
return force_unicode(s, encoding, strings_only, errors)
File "/usr/lib/python2.3/site-packages/django/utils/encoding.py", line
68, in force_unicode
s = s.decode(encoding, errors)
LookupError: unknown encoding: gbk2312
}}}
Sample Code:
{{{
import os
import datetime
import django.utils.dateformat
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
d = datetime.datetime.now()
print d
df = django.utils.dateformat.DateFormat(d)
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/10428>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---