Opened 10 years ago

Closed 10 years ago

Last modified 8 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: master
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


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/", line 72, in render_node
    result = node.render(context)
  File "/home/.../django/template/", line 88, in render
    output = self.filter_expression.resolve(context)
  File "/home/.../django/template/", line 580, in resolve
    new_obj = func(obj, *arg_vals)
  File "/home/.../django/template/", line 689, in date
    return date_format(value, arg)
  File "/home/.../django/utils/", line 54, in date_format
    return dateformat.format(value, get_format(format or 'DATE_FORMAT'))
  File "/home/.../django/utils/", 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 is set to 'ru-ru'

Using rev 11969

Change History (3)

comment:1 Changed 10 years ago by Jannis Leidel

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

comment:2 Changed 10 years ago by Jannis Leidel

Resolution: fixed
Status: assignedclosed

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

comment:3 Changed 8 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

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