Prevent fallback to "utf8" if "inputenc" package is not loaded.

Since April 2018, pdflatex falls back to input-encoding utf8 if
it does not detect an input encoding setting.
https://www.latex-project.org/news/latex2e-news/ltnews28.pdf

This leads to failure with CJK legacy encodings and may not
be what you want if selecting "Language Default (no inputenc)"
as document input-encoding.
This commit is contained in:
Günter Milde 2019-02-03 22:04:17 +01:00
parent f8d42aed39
commit 32e4a85e43

View File

@ -3256,6 +3256,10 @@ void BufferParams::writeEncodingPreamble(otexstream & os,
case Encoding::none:
case Encoding::CJK:
case Encoding::japanese:
if (encoding().iconvName() != "UTF-8")
// don't default to [utf8]{inputenc} with TeXLive >= 18
os << "\\ifdefined\\UseRawInputEncoding\n"
<< " \\UseRawInputEncoding\\fi\n";
break;
case Encoding::inputenc:
// do not load inputenc if japanese is used
@ -3272,6 +3276,11 @@ void BufferParams::writeEncodingPreamble(otexstream & os,
break;
}
}
if (inputenc == "default" or features.isRequired("japanese")) {
// don't default to [utf8]{inputenc} with TeXLive >= 18
os << "\\ifdefined\\UseRawInputEncoding\n";
os << " \\UseRawInputEncoding\\fi\n";
}
}