Include files with different input encoding

8-bit TeX engines (pdfTeX, TeX)

\inputencoding from package inputenc can also be used inside the document:

\documentclass[12pt]{article}
\usepackage{lmodern}
\usepackage[ngerman]{babel}

\usepackage[utf8]{inputenc}

\begin{document}

\inputencoding{latin1}
\include{Umlaute}       % ISO-8859-1 encoding
\inputencoding{utf8} % back to UTF-8

\end{document}

XeTeX

The input encoding can be specified with \XeTeXinputencoding in the correct file. Thus, Umlaute.tex starts with:

% Umlaute.tex
\XeTeXinputencoding ISO-8859-1

The syntax of \XeTeXinputencoding is quite obscure (missing documentation). From the source code:

  • The argument is scanned like a file name.
  • It can be surrounded by single or double quotes.
  • Then the name (without quotes) is checked in a case insensitive manner against the strings auto, utf8, utf16, utf16be, utf16le, bytes. (Source: XeTeX_ext.c, method getencodingmodeandinfo). If the name is not such a predefined name, then the name is passed to ucnv_open (ICU converter). From its documentation:

    The actual name will be resolved with the alias file using a case-insensitive string comparison that ignores leading zeroes and all non-alphanumeric characters. E.g., the names UTF8, utf-8, u*T@f08 and Utf 8 are all equivalent.

The previous version with curly braces has worked, because the name was not a predefined name, but was passed to ucnv_open, which filtered the curly braces out. Also the funny \XeTeXinputencoding}ISO-88;591{ would have worked.

Unicode-Engines (LuaTeX, XeTeX)

I would recode the non-UTF-8 files, e.g. (bash/linux):

recode latin1..utf8 Umlaute.tex