Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeDecodeError on funky pdflatex output #14

Open
thegcat opened this issue May 22, 2024 · 1 comment
Open

UnicodeDecodeError on funky pdflatex output #14

thegcat opened this issue May 22, 2024 · 1 comment

Comments

@thegcat
Copy link

thegcat commented May 22, 2024

I stumbled upon a problem with latexbuild where it trying to (UTF-8-)decode the output of pdflatex leads to a UnicodeDecodeError.

Minimal example to reproduce:

\documentclass{scrlttr2}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[sfdefault,scaled=.85]{FiraSans}

\begin{document}
Hiermit wird bestätigt, dass \textbf{Foooo Baaaar Baaaaaaaaaaz} an der 52,0. Konferenz der
Informatikfachschaften, die vom 8.5. - 12.5.2024 an der Rheinland-Pfälzischen
Technischen Universität Kaiserslautern-Landau in Kaiserslautern stattgefunden
hat.
\end{document}
from latexbuild import build_pdf
build_pdf('.', 'test.tex', 'foo.pdf')

This leads to:

Overfull \hbox (35.30524pt too wide) in paragraph at lines 7--11
\T1/FiraSans-OsF/regular/n/12 fach-schaften, die vom 8.5. - 12.5.2024 an der Rh
Failed during latex build
Traceback (most recent call last):
  File "/Users/thegcat/Code/kif/tebege/.direnv/python-3.11/lib/python3.11/site-packages/latexbuild/build.py", line 98, in run_latex
    stdout = check_output_cwd(cmd, path_template_dir)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/thegcat/Code/kif/tebege/.direnv/python-3.11/lib/python3.11/site-packages/latexbuild/subprocess_extension.py", line 32, in check_output_cwd
    line_str = line.decode().strip()
               ^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 10: invalid continuation byte
@thegcat
Copy link
Author

thegcat commented May 22, 2024

One solution is to ignore errors in the decode step, see https://toot.kif.rocks/@marlena/112485747608767645

We however sidestepped the issue by using the hyphenat package in the tex file so that "Kaiserslautern-Landau" could break and not lead to the overfull hbox error and the weird encoding stuff in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant