mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix: 'make gettext' cause UnicodeDecodeError when templates contain utf-8 encoded string.
This commit is contained in:
parent
b0b81d194d
commit
b91f70be6e
10
CHANGES
10
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)
|
Release 1.2 (beta1 released Mar 31, 2013)
|
||||||
=========================================
|
=========================================
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ class MessageCatalogBuilder(I18nBuilder):
|
|||||||
|
|
||||||
for template in self.status_iterator(files,
|
for template in self.status_iterator(files,
|
||||||
'reading templates... ', purple, len(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):
|
for line, meth, msg in extract_translations(context):
|
||||||
origin = MsgOrigin(template, line)
|
origin = MsgOrigin(template, line)
|
||||||
self.catalogs['sphinx'].add(msg, origin)
|
self.catalogs['sphinx'].add(msg, origin)
|
||||||
|
@ -3,3 +3,8 @@
|
|||||||
<h1>{{ _('Welcome') }}</h1>
|
<h1>{{ _('Welcome') }}</h1>
|
||||||
<p>{%trans%}Sphinx {{ version }}{%endtrans%}</p>
|
<p>{%trans%}Sphinx {{ version }}{%endtrans%}</p>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block comment %}
|
||||||
|
utf-8 encoded string: ニシキヘビ
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user