I include/\input
automatically generated files (tables generated by Stata) into my main document. I would like to compile that document with LuaLaTeX. Unfortunately the generated files are ANSI-encoded (Stata does not support unicode). LuaLaTeX thus throws a "String contains an invalid utf-8 sequence"
error at me. At the moment, the problem is only a single character, namely ¤ (U00A4 according to Windows Character Map). With XeLaTeX or without the character the document compiles fine.
I would prefer to not search and replace the character (with e.g. \textcurrency, though something that works in math-mode as well would be preferred), since it involves many included files that change often. For the same reason I would prefer to not convert the encoding of the included files by hand. I would also prefer a more robust solution, i.e. not only for single characters.
So is there a way to make LuaLaTeX use included files that are ANSI encoded, comparable to using \inputencoding with pdflatex?
Alternatively, is it possible to automatically search and replace when compiling?
Here is a MWE:
\documentclass{article}
\usepackage{luatextra, luaotfload}
\usepackage[vargreek-shape=unicode]{unicode-math} %
\defaultfontfeatures{Renderer=Basic,Scale=MatchLowercase, Ligatures={TeX}}
\setmainfont{Cambria}
\setmathfont{Cambria Math}
\begin{document}
A currency symbol in the main document: ¤
\input{input.tex}
\end{document}
input.tex just has one line, but is ANSI-encoded.
A currency symbol in the included document: ¤
\documentclass{...}
and ending with\end{document}
. I suspect this may be a font-related problem, as I have managed to format an International Currency Symbol without the problem you mention.