Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#12435 closed (fixed)

UnicodeEncodeError trying to use non-english letters for format string of date filter

Reported by: lupus Owned by: Jannis Leidel
Component: Internationalization Version: dev
Severity: Keywords: date filter decode error
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When i use |date:"d.m.Y в H:i", where "в" is russian letter, i get the following:

Original Traceback (most recent call last):
  File "/home/.../django/template/debug.py", line 72, in render_node
    result = node.render(context)
  File "/home/.../django/template/debug.py", line 88, in render
    output = self.filter_expression.resolve(context)
  File "/home/.../django/template/__init__.py", line 580, in resolve
    new_obj = func(obj, *arg_vals)
  File "/home/.../django/template/defaultfilters.py", line 689, in date
    return date_format(value, arg)
  File "/home/.../django/utils/formats.py", line 54, in date_format
    return dateformat.format(value, get_format(format or 'DATE_FORMAT'))
  File "/home/.../django/utils/formats.py", line 47, in get_format
    return getattr(settings, format_type)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0432' in position 6: ordinal not in range(128)

Language code in settings.py is set to 'ru-ru'

Using rev 11969

Change History (3)

comment:1 by Jannis Leidel, 15 years ago

milestone: 1.2
Owner: changed from nobody to Jannis Leidel
Status: newassigned
Triage Stage: UnreviewedAccepted

comment:2 by Jannis Leidel, 15 years ago

Resolution: fixed
Status: assignedclosed

(In [12057]) Fixed #12435 - Handle Unicode characters in format strings correctly.

comment:3 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top