Georg Brandl avatar Georg Brandl committed 154ef74

Fixes #816: Fix encoding issues in the Qt help builder.

Comments (0)

Files changed (2)

 * #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!


 from sphinx import addnodes
 from import StandaloneHTMLBuilder
+from sphinx.util import force_decode
 from sphinx.util.pycompat import htmlescape
         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))
-        sections = u'\n'.encode('utf-8').join(new_sections)
+        sections = u'\n'.join(new_sections)
         # keywords
         keywords = []
         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):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.