Commits

Georg Brandl committed 578147f

#232: Support non-ASCII metadata in Qt help builder.

Comments (0)

Files changed (2)

 Release 0.6.3 (in development)
 ==============================
 
+* #232: Support non-ASCII metadata in Qt help builder.
+
 * Properly format bullet lists nested in definition lists for LaTeX.
 
 * Section titles are now allowed inside ``only`` directives.

sphinx/builders/qthelp.py

 import os
 import re
 import cgi
+import codecs
 from os import path
 
 from docutils import nodes
 # It contains references to compressed help files which should be
 # included in the collection.
 # It may contain various other information for customizing Qt Assistant.
-collection_template = '''\
+collection_template = u'''\
 <?xml version="1.0" encoding="utf-8" ?>
 <QHelpCollectionProject version="1.0">
     <docFiles>
 # It contains the table of contents, indices and references to the
 # actual documentation files (*.html).
 # In addition it defines a unique namespace for the documentation.
-project_template = '''\
+project_template = u'''\
 <?xml version="1.0" encoding="UTF-8"?>
 <QtHelpProject version="1.0">
     <namespace>%(outname)s.org.%(outname)s.%(nversion)s</namespace>
 
     def build_qhcp(self, outdir, outname):
         self.info('writing collection project file...')
-        f = open(path.join(outdir, outname+'.qhcp'), 'w')
+        f = codecs.open(path.join(outdir, outname+'.qhcp'), 'w', 'utf-8')
         try:
             f.write(collection_template % {'outname': outname})
         finally:
         projectfiles = '\n'.join(projectfiles)
 
         # write the project file
-        f = open(path.join(outdir, outname+'.qhp'), 'w')
+        f = codecs.open(path.join(outdir, outname+'.qhp'), 'w', 'utf-8')
         try:
             nversion = self.config.version.replace('.', '_')
             nversion = nversion.replace(' ', '_')