summaryrefslogtreecommitdiff
path: root/Build/source/texk/kpathsea/elt-dirs.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/kpathsea/elt-dirs.c')
-rw-r--r--Build/source/texk/kpathsea/elt-dirs.c19
1 files changed, 18 insertions, 1 deletions
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;