Georg Brandl avatar Georg Brandl committed 5dd45e9

#432: Fix UnicodeErrors while building LaTeX in translated locale; do not swallow UnicodeError as a warning.

Comments (0)

Files changed (3)

 
 * #428: Add some missing CSS styles for standard docutils classes.
 
+* #432: Fix UnicodeErrors while building LaTeX in translated locale.
+
 
 Release 0.6.6 (May 25, 2010)
 ============================

sphinx/builders/latex.py

             doctree.settings.title = title
             doctree.settings.docname = docname
             doctree.settings.docclass = docclass
-            try:
-                docwriter.write(doctree, destination)
-            except UnicodeError:
-                self.warn("a Unicode error occurred when writing the output. "
-                          "Please make sure all config values that contain "
-                          "non-ASCII content are Unicode strings.")
-                return
+            docwriter.write(doctree, destination)
             self.info("done")
 
     def assemble_doctree(self, indexfile, toctree_only, appendices):

sphinx/writers/latex.py

             self.first_document = 0
         elif self.first_document == 0:
             # ... and all others are the appendices
-            self.body.append('\n\\appendix\n')
+            self.body.append(u'\n\\appendix\n')
             self.first_document = -1
         if node.has_key('docname'):
             self.body.append('\\hypertarget{--doc-%s}{}' %
             for bi in self.bibitems:
                 if len(widest_label) < len(bi[0]):
                     widest_label = bi[0]
-            self.body.append('\n\\begin{thebibliography}{%s}\n' % widest_label)
+            self.body.append(u'\n\\begin{thebibliography}{%s}\n' % widest_label)
             for bi in self.bibitems:
                 # cite_key: underscores must not be escaped
                 cite_key = bi[0].replace(r"\_", "_")
-                self.body.append('\\bibitem[%s]{%s}{\hypertarget{%s}{} %s}\n' %
+                self.body.append(u'\\bibitem[%s]{%s}{\hypertarget{%s}{} %s}\n' %
                                  (bi[0], cite_key,
                                   self.idescape(cite_key.lower()), bi[1]))
-            self.body.append('\\end{thebibliography}\n')
+            self.body.append(u'\\end{thebibliography}\n')
             self.bibitems = []
 
     def visit_start_of_file(self, node):
         pass
 
     def visit_seealso(self, node):
-        self.body.append("\n\n\\strong{%s:}\n\n" % admonitionlabels['seealso'])
+        self.body.append(u'\n\n\\strong{%s:}\n\n' % admonitionlabels['seealso'])
     def depart_seealso(self, node):
         self.body.append("\n\n")
 
             self.table.longtable = True
         self.body = self._body
         if not self.table.longtable and self.table.caption is not None:
-            self.body.append('\n\\begin{threeparttable}\n'
-                             '\\caption{%s}\n' % self.table.caption)
+            self.body.append(u'\n\\begin{threeparttable}\n'
+                             u'\\caption{%s}\n' % self.table.caption)
         if self.table.longtable:
             self.body.append('\n\\begin{longtable}')
         elif self.table.has_verbatim:
             else:
                 self.body.append('{|' + ('L|' * self.table.colcount) + '}\n')
         if self.table.longtable and self.table.caption is not None:
-            self.body.append('\\caption{%s} \\\\\n' % self.table.caption)
+            self.body.append(u'\\caption{%s} \\\\\n' % self.table.caption)
 
         if self.table.longtable:
             self.body.append('\\hline\n')
                              % _('continued from previous page'))
             self.body.append('\n\\hline\n')
             self.body.append('\\endhead\n\n')
-            self.body.append(r'\hline \multicolumn{%s}{|r|}{{%s}} \\ \hline'
+            self.body.append(ur'\hline \multicolumn{%s}{|r|}{{%s}} \\ \hline'
                              % (self.table.colcount,
                                 _('Continued on next page')))
             self.body.append('\n\\endfoot\n\n')
 
     def _make_visit_admonition(name):
         def visit_admonition(self, node):
-            self.body.append('\n\\begin{notice}{%s}{%s:}' %
+            self.body.append(u'\n\\begin{notice}{%s}{%s:}' %
                              (name, admonitionlabels[name]))
         return visit_admonition
     def _depart_named_admonition(self, node):
 
     def visit_inline(self, node):
         classes = node.get('classes', [])
-        self.body.append(r'\DUspan{%s}{' %','.join(classes))
+        self.body.append(r'\DUspan{%s}{' % ','.join(classes))
     def depart_inline(self, node):
         self.body.append('}')
 
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 ProjectModifiedEvent.java.
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.