I would like to use latexmk in Visual Studio Code with the LaTeX plugin but I am facing some issues regarding encoding:

Package inputenc: Invalid UTF-8 byte "A4.
Package inputenc: Invalid UTF-8 byte "B6.

Visual Studio Code has the option to save a file in another encoding. I tried that with UTF-8 -> didn't help.

I then tried the same with Notepad++ (which also didn't help). As a last option I used PowerShell:

Get-Content .\beamer.tex | Set-Content -Encoding utf8 beamer.tex

which also didn't help.

By now I am under the impression that this is some bug in latexmk. How could I still have non-UTF-8 characters in my text (and if so: how can I fix them once and for all)?

I also get some very unhelpful information on the command line:

beamer.vrb:21: Package inputenc Error: Invalid UTF-8 byte "A4.

Interestingly, the file beamer.vrb changes throughout the compile process so the error message is always a snapshot but has nothing to do with how beamer.vrb looks at the end, after compilation is finished. So I guess I'll never find out which characters are actually wrong?

  • 1
    most likely your source files are correct utf-8 but something in your use of the verbatim/fragile mechanism has causes an intermediate file to be written with incorrect bytes. Without an example going to be hard to debug try to add a small but complete example to your question. Dec 12, 2020 at 21:06
  • You should be able to tell from the log file which frame has the bad characters. since the page numbers are echoed to the log you can tell which pages are output before the error Dec 12, 2020 at 21:08


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.