#25720: 1.8.x regression: Py2 gettext() returns unicode for bytestring input
--------------------------------------+------------------------
     Reporter:  intgr                 |      Owner:  nobody
         Type:  Uncategorized         |     Status:  new
    Component:  Internationalization  |    Version:  1.8
     Severity:  Release blocker       |   Keywords:  regression
 Triage Stage:  Unreviewed            |  Has patch:  1
Easy pickings:  0                     |      UI/UX:  0
--------------------------------------+------------------------
 See pull request for the fix: https://github.com/django/django/pull/5615

 In Django 1.7 and earlier, the `django.utils.translation.gettext()`
 function always returned UTF-8 bytestrings for bytestring inputs. In
 Django 1.8, this behavior changed: when a translation is active, it now
 returns `unicode` objects instead. (when translations are **not**
 activated, it returns bytestrings).

 This does not appear to be an intentional change, there is nothing about
 this in release notes or documentation. Probably an unintended side-effect
 of the refactoring in
 
[https://github.com/django/django/commit/a5f6cbce07b5f3ab48d931e3fd1883c757fb9b45
 commit a5f6cbce07b5f3ab48d931e3fd1883c757fb9b45]:

 I narrowed it down to the removal of this line in `__init__`:
 {{{
 self.set_output_charset('utf-8')
 }}}

 After re-adding the line it works as expected again (tests included). I
 don't understand gettext enough to know why the addition in the refactor
 commit `gettext_module.translation(..., codeset='utf-8', ...)` doesn't
 have the same effect.

 This fix was sponsored by [https://voicecom.ee voicecom.ee].

--
Ticket URL: <https://code.djangoproject.com/ticket/25720>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/048.f47c3605e3302c67aaf9905fad13b7ad%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to