Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#12435 closed (fixed)

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

Reported by: lupus Owned by: jezdez
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: UI/UX:


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 7 years ago by jezdez

  • milestone set to 1.2
  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to jezdez
  • Patch needs improvement unset
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 7 years ago by jezdez

  • Resolution set to fixed
  • Status changed from assigned to closed

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

comment:3 Changed 5 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

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