From 1be2b895d747e48014289a826c371f60c4d6df9f Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Sat, 14 Feb 2015 10:45:13 +0100 Subject: [PATCH] Write fixed encoding to LyX file (bug #9178) If the user gave the -fixedenc argument to tex2lyx then set that encoding as LaTeX input encoding in the generated LyX file. Otherwise, included .bib files could be interpreted using a wrong encoding. --- src/tex2lyx/Preamble.h | 2 ++ src/tex2lyx/tex2lyx.cpp | 10 ++-------- status.21x | 2 ++ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/tex2lyx/Preamble.h b/src/tex2lyx/Preamble.h index 91f3a4882f..ae5886e08e 100644 --- a/src/tex2lyx/Preamble.h +++ b/src/tex2lyx/Preamble.h @@ -37,6 +37,8 @@ public: /// std::string inputencoding() const { return h_inputencoding; } /// + void setInputencoding(std::string const & e) { h_inputencoding = e; } + /// std::string notefontcolor() const { return h_notefontcolor; } /// bool refstyle() const { return h_use_refstyle; } diff --git a/src/tex2lyx/tex2lyx.cpp b/src/tex2lyx/tex2lyx.cpp index 9e3257cf73..c3cf99acb6 100644 --- a/src/tex2lyx/tex2lyx.cpp +++ b/src/tex2lyx/tex2lyx.cpp @@ -788,14 +788,6 @@ bool roundtripMode() } -string fixedEncoding() -{ - if (fixed_encoding) - return default_encoding; - return ""; -} - - namespace { /*! @@ -1064,6 +1056,8 @@ int main(int argc, char * argv[]) if (!enc) error_message("Unknown LaTeX encoding `" + default_encoding + "'"); default_encoding = enc->iconvName(); + if (fixed_encoding) + preamble.setInputencoding(enc->name()); } // Load the layouts diff --git a/status.21x b/status.21x index a8da9d48e0..8470f2ecbf 100644 --- a/status.21x +++ b/status.21x @@ -102,6 +102,8 @@ What's new * TEX2LYX +- Write fixed encoding to LyX file if -fixedenc was given (bug 9178). + -- 2.39.5