ThirdParty/Pygments/pygments/formatters/latex.py

changeset 5072
aab59042fefb
parent 4697
c2e9bf425554
child 5713
6762afd9f963
diff -r 4e4651e88674 -r aab59042fefb ThirdParty/Pygments/pygments/formatters/latex.py
--- a/ThirdParty/Pygments/pygments/formatters/latex.py	Wed Jul 27 18:10:08 2016 +0200
+++ b/ThirdParty/Pygments/pygments/formatters/latex.py	Fri Jul 29 19:50:40 2016 +0200
@@ -413,11 +413,18 @@
         outfile.write(u'\\end{' + self.envname + u'}\n')
 
         if self.full:
+            encoding = self.encoding or 'utf8'
+            # map known existings encodings from LaTeX distribution
+            encoding = {
+                'utf_8': 'utf8',
+                'latin_1': 'latin1',
+                'iso_8859_1': 'latin1',
+            }.get(encoding.replace('-', '_'), encoding)
             realoutfile.write(DOC_TEMPLATE %
                 dict(docclass  = self.docclass,
                      preamble  = self.preamble,
                      title     = self.title,
-                     encoding  = self.encoding or 'utf8',
+                     encoding  = encoding,
                      styledefs = self.get_style_defs(),
                      code      = outfile.getvalue()))
 

eric ide

mercurial