﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
25720	1.8.x regression: Py2 gettext() returns unicode for bytestring input	Marti Raudsepp	nobody	"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].
"	Bug	closed	Internationalization	1.8	Release blocker	fixed	regression		Ready for checkin	1	0	0	0	0	0
