Problem
VerbatimOut from the "fancyvrb" package does not play well with UTF-8 characters.
Minimum working example:
\documentclass{minimal} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{fancyvrb} \begin{document} \begin{VerbatimOut}{\jobname.test} é \end{VerbatimOut} \input{\jobname.test} \end{document}
Error message
When compiling using pdflatex mini this gives an error
The file ended while scanning using \UTFviii@three@octets .
Another error occurs when a single occurrence of é above is replaced by something else, for example. é */ :
Package input error Error: Unicode char \u8:### not configured for use with LaTeX.
- indicating that in this case, LaTeX succeeds in reading the multibyte UTF-8 character, but does not know what to do with it (i.e. its incorrect character).
In fact, when I open the created .test file manually, it contains the é character, but in Latin-1 encoding !
Proof: when I open the files in a hex editor, I get the following:
- Source file:
C3 A9 (corresponds to LATIN SMALL LETTER E WITH ACUTE in UTF-8) - Written file:
E9 (matches é in Latin-1)
Question
How to install VerbatimOut ?
filecontents* (from "filecontents") indicates that it can work. Unfortunately, I do not understand any code, so I can not fix the fancyvrbs code by manually replicating the logic from file resources.
I also cannot use filecontents* instead of VerbatimOut , because the former does not work inside \newenvironment , and the latter does.
(Oh, by the way: vanilla Verbatim instead of VerbatimOut also works as expected. An error occurs when writing a file, and not when reading verbatim input)
unicode latex
Konrad Rudolph
source share