diff --git a/CHANGES b/CHANGES index 16971e22b..2fb7e1d58 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,13 @@ +Release 1.2 (in development) +============================ + +Bugs fixed +---------- + +* Fix: 'make gettext' cause UnicodeDecodeError when templates contain utf-8 + encoded string. + + Release 1.2 (beta1 released Mar 31, 2013) ========================================= diff --git a/sphinx/builders/gettext.py b/sphinx/builders/gettext.py index cdee4be30..87d986c85 100644 --- a/sphinx/builders/gettext.py +++ b/sphinx/builders/gettext.py @@ -139,7 +139,7 @@ class MessageCatalogBuilder(I18nBuilder): for template in self.status_iterator(files, 'reading templates... ', purple, len(files)): - context = open(template, 'rt').read() #TODO: encoding + context = open(template, 'r', encoding='utf-8').read() for line, meth, msg in extract_translations(context): origin = MsgOrigin(template, line) self.catalogs['sphinx'].add(msg, origin) diff --git a/tests/roots/test-intl/_templates/index.html b/tests/roots/test-intl/_templates/index.html index 22bc0e832..d730545d1 100644 --- a/tests/roots/test-intl/_templates/index.html +++ b/tests/roots/test-intl/_templates/index.html @@ -3,3 +3,8 @@

{{ _('Welcome') }}

{%trans%}Sphinx {{ version }}{%endtrans%}

{% endblock %} + +{% block comment %} +utf-8 encoded string: ニシキヘビ +{% endblock %} +