commit ac351f40f1d1b47b0672587aea26524dbb18b6d9
Author: Juergen Spitzmueller <[email protected]>
Date:   Sun May 27 11:54:07 2018 +0200

    Fix encoding problems in \input@path
    
    As of LaTeX2e 2018, characters are made active earlier, which results
    in new expansion problems.
    
    Following a suggestion of Markus Kohm (pc) and the TL mailing list [1],
    we embrace non-ASCII input paths in \detokenize. This relies on e-tex,
    but I think we can assume this is nowadays available everywhere.
    
    [1] http://tug.org/pipermail/tex-live/2018-May/041691.html
    
    Fixes: #11146
    (cherry picked from commit 8bd65041f2e22bf4c37219c7008a7e4e2bda2799)
---
 src/Buffer.cpp |   18 ++++++++++++++----
 status.23x     |    2 ++
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index e572fb3..89d3c05 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -1876,8 +1876,7 @@ void Buffer::writeLaTeXSource(otexstream & os,
                                            "file path name."),
                                          inputpath, uncodable_glyphs));
                        } else {
-                               string docdir =
-                                       support::latex_path(original_path);
+                               string docdir = os::latex_path(original_path);
                                if (contains(docdir, '#')) {
                                        docdir = subst(docdir, "#", "\\#");
                                        os << "\\catcode`\\#=11"
@@ -1888,9 +1887,20 @@ void Buffer::writeLaTeXSource(otexstream & os,
                                        os << "\\catcode`\\%=11"
                                              "\\def\\%{%}\\catcode`\\%=14\n";
                                }
+                               bool const detokenize = 
!isAscii(from_utf8(docdir));
+                               bool const quote = contains(docdir, ' ');
                                os << "\\makeatletter\n"
-                                  << "\\def\\input@path{{"
-                                  << docdir << "}}\n"
+                                  << "\\def\\input@path{{";
+                               if (detokenize)
+                                       os << "\\detokenize{";
+                               if (quote)
+                                       os << "\"";
+                               os << docdir;
+                               if (quote)
+                                       os << "\"";
+                               if (detokenize)
+                                       os << "}";
+                               os << "}}\n"
                                   << "\\makeatother\n";
                        }
                }
diff --git a/status.23x b/status.23x
index 8f0ea4a..7a2970d 100644
--- a/status.23x
+++ b/status.23x
@@ -48,6 +48,8 @@ What's new
 
 * DOCUMENT INPUT/OUTPUT
 
+- Fix problems with non-ASCII characters in path with recent LaTeX versions
+  (bug 11146).
 
 
 * USER INTERFACE

Reply via email to