]> git.lyx.org Git - features.git/commitdiff
Prevent fallback to "utf8" if "inputenc" package is not loaded.
authorGünter Milde <milde@lyx.org>
Sun, 3 Feb 2019 21:04:17 +0000 (22:04 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 12:39:57 +0000 (14:39 +0200)
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

index 57c75762ede36a71d213fb316476b9a3b6306d22..42959549119fe85f2f73da388ae349756f543f3a 100644 (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";
+       }
 }