summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2012-03-10 21:02:08 +0100
committerGeorg Brandl <georg@python.org>2012-03-10 21:02:08 +0100
commit7ecc658c716efac101e75820d45cc7b695ddfbde (patch)
tree50a5a6a56d89cfcffcde1b78f803962c2ed7bee0
parent95f0155227e9d0186f38cf492f6a933613b2b4d3 (diff)
downloadsphinx-git-7ecc658c716efac101e75820d45cc7b695ddfbde.tar.gz
Fixes #816: Fix encoding issues in the Qt help builder.
-rw-r--r--CHANGES2
-rw-r--r--sphinx/builders/qthelp.py14
2 files changed, 10 insertions, 6 deletions
diff --git a/CHANGES b/CHANGES
index 2a079f38b..c344541af 100644
--- a/CHANGES
+++ b/CHANGES
@@ -53,6 +53,8 @@ Release 1.1.3 (in development)
* #873: Fix assertion errors with empty ``only`` directives.
+* #816: Fix encoding issues in the Qt help builder.
+
Release 1.1.2 (Nov 1, 2011) -- 1.1.1 is a silly version number anyway!
======================================================================
diff --git a/sphinx/builders/qthelp.py b/sphinx/builders/qthelp.py
index 662c443e0..6a40005f0 100644
--- a/sphinx/builders/qthelp.py
+++ b/sphinx/builders/qthelp.py
@@ -19,6 +19,7 @@ from docutils import nodes
from sphinx import addnodes
from sphinx.builders.html import StandaloneHTMLBuilder
+from sphinx.util import force_decode
from sphinx.util.pycompat import htmlescape
@@ -130,16 +131,17 @@ class QtHelpBuilder(StandaloneHTMLBuilder):
for indexname, indexcls, content, collapse in self.domain_indices:
item = section_template % {'title': indexcls.localname,
'ref': '%s.html' % indexname}
- sections.append((' ' * 4 * 4 + item).encode('utf-8'))
+ sections.append(' ' * 4 * 4 + item)
# sections may be unicode strings or byte strings, we have to make sure
- # they are all byte strings before joining them
+ # they are all unicode strings before joining them
new_sections = []
for section in sections:
- if isinstance(section, unicode):
- new_sections.append(section.encode('utf-8'))
+ if not isinstance(section, unicode):
+ # XXX is this really necessary?
+ new_sections.append(force_decode(section, None))
else:
new_sections.append(section)
- sections = u'\n'.encode('utf-8').join(new_sections)
+ sections = u'\n'.join(new_sections)
# keywords
keywords = []
@@ -147,7 +149,7 @@ class QtHelpBuilder(StandaloneHTMLBuilder):
for (key, group) in index:
for title, (refs, subitems) in group:
keywords.extend(self.build_keywords(title, refs, subitems))
- keywords = '\n'.join(keywords)
+ keywords = u'\n'.join(keywords)
# files
if not outdir.endswith(os.sep):