From e83bbca9d9ca3413bfd712f56ba0393fe0ccc171 Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=BCnter=20Milde?= Date: Sun, 3 Feb 2019 22:04:17 +0100 Subject: [PATCH] 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. --- src/BufferParams.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 57c75762ed..4295954911 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -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"; + } } -- 2.39.5