Created
October 9, 2012 15:58
-
-
Save shirosaki/3859711 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/hash.c b/hash.c | |
index 06d0ce9..148f802 100644 | |
--- a/hash.c | |
+++ b/hash.c | |
@@ -2110,7 +2110,7 @@ static VALUE | |
env_str_new(const char *ptr, long len) | |
{ | |
#ifdef _WIN32 | |
- VALUE str = rb_str_conv_enc(rb_str_new(ptr, len), rb_utf8_encoding(), rb_locale_encoding()); | |
+ VALUE str = rb_str_conv_enc(rb_filesystem_str_new(ptr, len), NULL, rb_locale_encoding()); | |
#else | |
VALUE str = rb_locale_str_new(ptr, len); | |
#endif | |
@@ -2192,11 +2192,7 @@ rb_f_getenv(VALUE obj, VALUE name) | |
env = getenv(nam); | |
if (env) { | |
if (ENVMATCH(nam, PATH_ENV) && !env_path_tainted(env)) { | |
-#ifdef _WIN32 | |
- VALUE str = rb_str_conv_enc(rb_str_new(env, strlen(env)), rb_utf8_encoding(), rb_filesystem_encoding()); | |
-#else | |
VALUE str = rb_filesystem_str_new_cstr(env); | |
-#endif | |
rb_obj_freeze(str); | |
return str; | |
@@ -2247,11 +2243,7 @@ env_fetch(int argc, VALUE *argv) | |
return if_none; | |
} | |
if (ENVMATCH(nam, PATH_ENV) && !env_path_tainted(env)) | |
-#ifdef _WIN32 | |
- return rb_str_conv_enc(rb_str_new(env, strlen(env)), rb_utf8_encoding(), rb_filesystem_encoding()); | |
-#else | |
return rb_filesystem_str_new_cstr(env); | |
-#endif | |
return env_str_new2(env); | |
} | |
diff --git a/win32/win32.c b/win32/win32.c | |
index 7eaf1fc..27964a7 100644 | |
--- a/win32/win32.c | |
+++ b/win32/win32.c | |
@@ -4281,7 +4281,7 @@ rb_w32_ugetenv(const char *name) | |
} | |
for (wenv = wenvarea, wlen = 1; *wenv; wenv += lstrlenW(wenv) + 1) | |
wlen += lstrlenW(wenv) + 1; | |
- uenvarea = wstr_to_mbstr(CP_UTF8, wenvarea, wlen, NULL); | |
+ uenvarea = wstr_to_mbstr(filecp(), wenvarea, wlen, NULL); | |
FreeEnvironmentStringsW(wenvarea); | |
if (!uenvarea) | |
return NULL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Win7 Ultimate 32bit - TestWEBrickCGI#test_cgi test w/codepages 437, 1252, 65001