summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/source/texk/kpathsea/ChangeLog6
-rw-r--r--Build/source/texk/kpathsea/elt-dirs.c19
-rw-r--r--Build/source/texk/kpathsea/knj.c7
-rw-r--r--Build/source/texk/kpathsea/progname.c5
4 files changed, 33 insertions, 4 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog
index ddfa0f799e4..2cbff81c81e 100644
--- a/Build/source/texk/kpathsea/ChangeLog
+++ b/Build/source/texk/kpathsea/ChangeLog
@@ -1,3 +1,9 @@
+2018-11-23 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * elt-dirs.c, knj.c, progname.c: Support non-ascii values
+ for variables in the case of
+ command_line_encoding = utf-8 (w32 only).
+
2018-11-12 Andreas Scherer <https://ascherer.github.io>
* tex-make.c (maketex): check return value from dup(2).
diff --git a/Build/source/texk/kpathsea/elt-dirs.c b/Build/source/texk/kpathsea/elt-dirs.c
index 5db08f37099..799cca705f6 100644
--- a/Build/source/texk/kpathsea/elt-dirs.c
+++ b/Build/source/texk/kpathsea/elt-dirs.c
@@ -1,7 +1,7 @@
/* elt-dirs.c: Translate a path element to its corresponding director{y,ies}.
Copyright 1993, 1994, 1995, 1996, 1997, 2008, 2009, 2010, 2011, 2016,
- 2017 Karl Berry.
+ 2017, 2018 Karl Berry.
Copyright 1997, 1998, 1999, 2000, 2005 Olaf Weber.
This library is free software; you can redistribute it and/or
@@ -409,6 +409,23 @@ kpathsea_element_dirs (kpathsea kpse, string elt)
str_llist_type *ret;
unsigned i;
+#ifdef _WIN32
+/*
+ Change encoding of a variable into kpse->File_system_codepage
+ to support non-ascii values for the variable.
+*/
+ if (kpse->File_system_codepage != kpse->Win32_codepage) {
+ char *tname;
+ wchar_t *wtname;
+ wtname = get_wstring_from_mbstring (kpse->Win32_codepage,
+ elt, wtname = NULL);
+ tname = get_mbstring_from_wstring (kpse->File_system_codepage,
+ wtname, tname = NULL);
+ elt = tname;
+ free(wtname);
+ }
+#endif
+
/* If given nothing, return nothing. */
if (!elt || !*elt)
return NULL;
diff --git a/Build/source/texk/kpathsea/knj.c b/Build/source/texk/kpathsea/knj.c
index 09d718ce8e2..6db6262161f 100644
--- a/Build/source/texk/kpathsea/knj.c
+++ b/Build/source/texk/kpathsea/knj.c
@@ -1,6 +1,6 @@
/* knj.c: check for 2-Byte Kanji (CP 932, SJIS) codes.
- Copyright 2010, 2016 Akira Kakuto.
+ Copyright 2010, 2016, 2018 Akira Kakuto.
Copyright 2013, 2016 TANAKA Takuji.
This library is free software; you can redistribute it and/or
@@ -244,7 +244,12 @@ kpathsea_get_command_line_args_utf8 (kpathsea kpse, const_string enc, int *p_ac,
hStderr = GetStdHandle( STD_ERROR_HANDLE );
#endif /* DEBUG */
kpse->File_system_codepage = CP_UTF8;
+/*
+ IS_KANJI() in the CP932-like system seems to be necessary to
+ support non-ascii values for variables in the case of
+ command_line_encoding = utf-8.
kpse->Is_cp932_system = 0;
+*/
argvw = CommandLineToArgvW(GetCommandLineW(), &argcw);
argc = argcw;
argv = xmalloc(sizeof(char *)*(argcw+1));
diff --git a/Build/source/texk/kpathsea/progname.c b/Build/source/texk/kpathsea/progname.c
index 54563f136ba..545f4439250 100644
--- a/Build/source/texk/kpathsea/progname.c
+++ b/Build/source/texk/kpathsea/progname.c
@@ -494,9 +494,10 @@ kpathsea_set_program_name (kpathsea kpse, const_string argv0,
}
#if defined(WIN32)
+ cp = AreFileApisANSI() ? GetACP() : GetOEMCP();
if (!kpse->File_system_codepage)
- kpse->File_system_codepage = AreFileApisANSI() ? GetACP() : GetOEMCP();
- cp = kpse->Win32_codepage = kpse->File_system_codepage;
+ kpse->File_system_codepage = cp;
+ kpse->Win32_codepage = cp;
if (cp == 932 || cp == 936 || cp == 950) {
kpse->Is_cp932_system = cp;
}