pyx-project / pyx

Repository of PyX, a Python package for the creation of PostScript, PDF, and SVG files.
https://pyx-project.org/
GNU General Public License v2.0
109 stars 18 forks source link

encoding problem in LaTeX log #1

Closed gertingold closed 6 years ago

gertingold commented 6 years ago

In the LaTeX log, characters appearing in the TeX input are represented using the fontenc. This can ultimately lead to a UnicodeDecodeError as in the following minimal example:

from pyx import canvas, text

text.set(text.LatexRunner, texenc="utf-8")
text.preamble(r"""\usepackage[T1]{fontenc}
                  \usepackage[utf8x]{inputenc}""")
c = canvas.canvas()
c.text(0, 0, r'foo föo föo f\"oo f\"oo', [text.parbox(2)])
c.writePDFfile()

In the LaTeX log, the umlaut ö will be represented as byte 0xf6 which cannot be interpreted as UTF-8 encoded character. The problem arises independently of whether the umlaut in the input is given in UTF-8 or in TeX code (\"o).

gertingold commented 6 years ago

fixed in 33159cc