#24741: UnicodeDecodeError in gettext via migrations autodetector
----------------------------+--------------------------------------
Reporter: drakkan | Owner: nobody
Type: Bug | Status: closed
Component: Migrations | Version: 1.8
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+--------------------------------------
Changes (by charettes):
* resolution: needsinfo => invalid
Comment:
Hi drakkan,
As the name of the `ugettext` and `ugettext_lazy` method indicate they
expect a `unicode` parameter to be provided.
When you call `ugettext()` with a `utf-8` encoded byte string the method
crash as expected and works correctly when you pass unicode strings (`u`
prefixed strings).
I would suggest you make sure to define your translation strings as
`unicode` by either prefixing them with the `u` prefix or using `from
__future__ import unicode_literals`. If you must retrieve a translated
string from a byte strings use the `gettext` and `gettext_lazy` method
instead. Just keep in mind that Django expects `unicode` to be provided
internally when dealing with localization.
--
Ticket URL: <https://code.djangoproject.com/ticket/24741#comment:5>
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/065.3c62a050ba40e8e0ef7a993e793f2a44%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.