The branch, master, has been updated.

- Log -----------------------------------------------------------------

commit 0601336c243e1c333ec9607fe05c7d40e7b50485
Author: Julien Rioux <[email protected]>
Date:   Sat Jan 19 20:02:33 2013 +0100

    Respect the encoding passed to tex2lyx on the command line.
    
    Fixup for #8218, fixes #8518.

diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp
index 4e976ec..61ce6b8 100644
--- a/src/tex2lyx/Preamble.cpp
+++ b/src/tex2lyx/Preamble.cpp
@@ -727,11 +727,19 @@ void Preamble::handle_package(Parser &p, string const & 
name,
                        handle_opt(options, known_languages, h_language);
                        // translate the babel name to a LyX name
                        h_language = babel2lyx(h_language);
-                       // for Japanese we assume EUC-JP as encoding
-                       // but we cannot determine the exact encoding and thus 
output also a note
                        if (h_language == "japanese") {
-                               h_inputencoding = "euc";
-                               p.setEncoding("EUC-JP");
+                               // For Japanese, the encoding isn't indicated 
in the source
+                               // file, and there's really not much we can do. 
We could
+                               // 1) offer a list of possible encodings to 
choose from, or
+                               // 2) determine the encoding of the file by 
inspecting it.
+                               // For the time being, we leave the encoding 
alone so that
+                               // we don't get iconv errors when making a 
wrong guess, and
+                               // we will output a note at the top of the 
document
+                               // explaining what to do.
+                               Encoding const * const enc = 
encodings.fromIconvName(
+                                       p.getEncoding(), Encoding::japanese, 
true);
+                               if (enc)
+                                       h_inputencoding = enc->name();
                                is_nonCJKJapanese = true;
                                // in this case babel can be removed from the 
preamble
                                registerAutomaticallyLoadedPackage("babel");
diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp
index 9d90c2d..51e413b 100644
--- a/src/tex2lyx/text.cpp
+++ b/src/tex2lyx/text.cpp
@@ -2218,10 +2218,13 @@ void parse_text(Parser & p, ostream & os, unsigned 
flags, bool outer,
                   << "Important information:\n"
                   << "\\end_layout\n\n"
                   << "\\begin_layout Plain Layout\n"
-                  << "This document is in Japanese (non-CJK).\n"
-                  << " It was therefore impossible for tex2lyx to determine 
the correct encoding."
-                  << " The encoding EUC-JP was assumed. If this is incorrect, 
please set the correct"
-                  << " encoding in the document settings.\n"
+                  << "The original LaTeX source for this document is in 
Japanese (pLaTeX).\n"
+                  << " It was therefore impossible for tex2lyx to determine 
the correct encoding.\n"
+                  << " The iconv encoding " << p.getEncoding() << " was 
used.\n"
+                  << " If this is incorrect, you must run the tex2lyx program 
on the command line\n"
+                  << " and specify the encoding using the -e command-line 
switch.\n"
+                  << " In addition, you might want to double check that the 
desired output encoding\n"
+                  << " is correctly selected in Document > Settings > 
Language.\n"
                   << "\\end_layout\n";
                end_inset(os);
                is_nonCJKJapanese = false;

-----------------------------------------------------------------------

Summary of changes:
 src/tex2lyx/Preamble.cpp |   16 ++++++++++++----
 src/tex2lyx/text.cpp     |   11 +++++++----
 2 files changed, 19 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
The LyX Source Repository

Reply via email to