mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Small improvement for bug #7509 as suggested by JMarc
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38628 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2ff1181e52
commit
12f8e7a6f9
@ -48,6 +48,7 @@ const char * const modules_placeholder = "\001modules\001";
|
||||
|
||||
// needed to handle encodings with babel
|
||||
bool one_language = true;
|
||||
string h_inputencoding = "auto";
|
||||
|
||||
namespace {
|
||||
|
||||
@ -165,7 +166,6 @@ string h_textclass = "article";
|
||||
string h_use_default_options = "false";
|
||||
string h_options;
|
||||
string h_language = "english";
|
||||
string h_inputencoding = "auto";
|
||||
string h_font_roman = "default";
|
||||
string h_font_sans = "default";
|
||||
string h_font_typewriter = "default";
|
||||
@ -517,7 +517,7 @@ void handle_package(Parser &p, string const & name, string const & opts,
|
||||
else if (name == "fontenc")
|
||||
;// ignore this
|
||||
|
||||
else if (name == "inputenc") {
|
||||
else if (name == "inputenc" || name == "luainputenc") {
|
||||
// h_inputencoding is only set when there is not more than one
|
||||
// inputenc option because otherwise h_inputencoding must be
|
||||
// set to "auto" (the default encoding of the document language)
|
||||
|
@ -624,11 +624,22 @@ namespace {
|
||||
* You must ensure that \p parentFilePath is properly set before calling
|
||||
* this function!
|
||||
*/
|
||||
void tex2lyx(idocstream & is, ostream & os, string const & encoding)
|
||||
void tex2lyx(idocstream & is, ostream & os, string encoding)
|
||||
{
|
||||
// Set a sensible default encoding.
|
||||
// This is used until an encoding command is found.
|
||||
// For child documents use the encoding of the master, else latin1,
|
||||
// since latin1 does not cause an iconv error if the actual encoding
|
||||
// is different (bug 7509).
|
||||
if (encoding.empty()) {
|
||||
if (h_inputencoding == "auto")
|
||||
encoding = "latin1";
|
||||
else
|
||||
encoding = h_inputencoding;
|
||||
}
|
||||
|
||||
Parser p(is);
|
||||
if (!encoding.empty())
|
||||
p.setEncoding(encoding);
|
||||
p.setEncoding(encoding);
|
||||
//p.dump();
|
||||
|
||||
ostringstream ps;
|
||||
|
@ -52,6 +52,7 @@ extern std::string babel2lyx(std::string const & language);
|
||||
/// used packages with options
|
||||
extern std::map<std::string, std::vector<std::string> > used_packages;
|
||||
extern const char * const modules_placeholder;
|
||||
extern std::string h_inputencoding;
|
||||
|
||||
/// in text.cpp
|
||||
std::string translate_len(std::string const &);
|
||||
|
Loading…
Reference in New Issue
Block a user