texlive[49229] Build/source/texk/kpathsea: support non-ascii values
commits+kakuto at tug.org
commits+kakuto at tug.org
Fri Nov 23 10:42:40 CET 2018
Revision: 49229
http://tug.org/svn/texlive?view=revision&revision=49229
Author: kakuto
Date: 2018-11-23 10:42:40 +0100 (Fri, 23 Nov 2018)
Log Message:
-----------
support non-ascii values for variables (w32 only)
Modified Paths:
--------------
trunk/Build/source/texk/kpathsea/ChangeLog
trunk/Build/source/texk/kpathsea/elt-dirs.c
trunk/Build/source/texk/kpathsea/knj.c
trunk/Build/source/texk/kpathsea/progname.c
Modified: trunk/Build/source/texk/kpathsea/ChangeLog
===================================================================
--- trunk/Build/source/texk/kpathsea/ChangeLog 2018-11-23 01:23:16 UTC (rev 49228)
+++ trunk/Build/source/texk/kpathsea/ChangeLog 2018-11-23 09:42:40 UTC (rev 49229)
@@ -1,3 +1,9 @@
+2018-11-23 Akira Kakuto <kakuto at 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).
Modified: trunk/Build/source/texk/kpathsea/elt-dirs.c
===================================================================
--- trunk/Build/source/texk/kpathsea/elt-dirs.c 2018-11-23 01:23:16 UTC (rev 49228)
+++ trunk/Build/source/texk/kpathsea/elt-dirs.c 2018-11-23 09:42:40 UTC (rev 49229)
@@ -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 @@
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;
Modified: trunk/Build/source/texk/kpathsea/knj.c
===================================================================
--- trunk/Build/source/texk/kpathsea/knj.c 2018-11-23 01:23:16 UTC (rev 49228)
+++ trunk/Build/source/texk/kpathsea/knj.c 2018-11-23 09:42:40 UTC (rev 49229)
@@ -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 @@
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));
Modified: trunk/Build/source/texk/kpathsea/progname.c
===================================================================
--- trunk/Build/source/texk/kpathsea/progname.c 2018-11-23 01:23:16 UTC (rev 49228)
+++ trunk/Build/source/texk/kpathsea/progname.c 2018-11-23 09:42:40 UTC (rev 49229)
@@ -494,9 +494,10 @@
}
#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;
}
More information about the tex-live-commits
mailing list