path: root/win32
diff options
authorLars Kanis <>2020-12-07 18:00:39 +0100
committerGitHub <>2020-12-08 02:00:39 +0900
commitca76337a00244635faa331afd04f4b75161ce6fb (patch)
tree7fae6bdb4c21e81656b2c6399c26752f075bcce5 /win32
parent94b6933d1c6f4c8698319fbcac9dcecc9033b4b9 (diff)
Windows: Read ENV names and values as UTF-8 encoded Strings (#3818)
* Windows: Read ENV names and values as UTF-8 encoded Strings Implements issue #12650: fix This also removes the special encoding for ENV['PATH'] and some complexity in the code that is unnecessary now. * Windows: Improve readablity of getenv() encoding getenv() did use the expected codepage as an implicit parameter of the macro. This is mis-leading since include/ruby/win32.h has a different definition. Using the "cp" variable explicit (like the other function calls) makes it more readable and consistent. * Windows: Change external C-API macros getenv() and execv() to use UTF-8 They used to process and return strings with locale encoding, but since all ruby-internal spawn and environment functions use UTF-8, it makes sense to change the C-API equally.
Notes: Merged-By: nurse <>
Diffstat (limited to 'win32')
1 files changed, 0 insertions, 1 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 17449fa..ac83195 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -77,7 +77,6 @@ static char *w32_getenv(const char *name, UINT cp);
#define DLN_FIND_EXTRA_ARG ,cp
#define rb_w32_stati128(path, st) w32_stati128(path, st, cp, FALSE)
-#define getenv(name) w32_getenv(name, cp)
#undef CharNext
#define CharNext(p) CharNextExA(cp, (p), 0)
#define dln_find_exe_r rb_w32_udln_find_exe_r