// needed to handle encodings with babel
bool one_language = true;
+string h_inputencoding = "auto";
namespace {
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";
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)
* 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;
/// 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 &);
- Fix validation problem with user macros (bug #7525).
+- Improve import of LaTeX documents with non-ASCII contents before loading
+ the inputenc package (bug #7509).
+
* USER INTERFACE