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; |
Win7 Ultimate 32bit - TestWEBrickCGI#test_cgi test w/codepages 437, 1252, 65001
C:\Jenkins\workspace>chcp Active code page: 1252 C:\Jenkins\workspace>ruby -I ruby-trunk-svn\test\webrick ruby-trunk-svn\test\webrick\test_cgi.rb Run options: # Running tests: Finished tests in 3.688211s, 1.0845 tests/s, 7.8629 assertions/s. 4 tests, 29 assertions, 0 failures, 0 errors, 0 skips ruby -v: ruby 2.0.0dev (2012-10-09 trunk 37127) [i386-mingw32] C:\Jenkins\workspace>chcp 437 Active code page: 437 C:\Jenkins\workspace>ruby -I ruby-trunk-svn\test\webrick ruby-trunk-svn\test\webrick\test_cgi.rb Run options: # Running tests: [4/4] TestWEBrickCGI#test_cgi = 1.22 s 1) Failure: test_cgi(TestWEBrickCGI) [ruby-trunk-svn/test/webrick/test_cgi.rb:41]: webrick log start: [2012-10-10 20:42:33] INFO WEBrick 1.3.1 [2012-10-10 20:42:33] INFO ruby 2.0.0 (2012-10-09) [i386-mingw32] [2012-10-10 20:42:33] INFO WEBrick::HTTPServer#start: pid=1620 port=50961 webrick log end. "/\xA4\xDB\xA4\xB2/\xA4\xDB\xA4\xB2" expected but was "/\xC2\xA4\xC3\x9B\xC2\xA4\xC2\xB2/\xC2\xA4\xC3\x9B\xC2\xA4\xC2\xB2". Finished tests in 1.578090s, 2.5347 tests/s, 11.4062 assertions/s. 4 tests, 18 assertions, 1 failures, 0 errors, 0 skips ruby -v: ruby 2.0.0dev (2012-10-09 trunk 37127) [i386-mingw32] C:\Jenkins\workspace>chcp 65001 Active code page: 65001 C:\Jenkins\workspace>ruby -I ruby-trunk-svn\test\webrick ruby-trunk-svn\test\webrick\test_cgi.rb Run options: # Running tests: [4/4] TestWEBrickCGI#test_cgi = 1.21 s 1) Failure: test_cgi(TestWEBrickCGI) [ruby-trunk-svn/test/webrick/test_cgi.rb:41]: webrick log start: [2012-10-10 20:42:42] INFO WEBrick 1.3.1 [2012-10-10 20:42:42] INFO ruby 2.0.0 (2012-10-09) [i386-mingw32] [2012-10-10 20:42:42] INFO WEBrick::HTTPServer#start: pid=1516 port=50972 webrick log end. "/\xA4\xDB\xA4\xB2/\xA4\xDB\xA4\xB2" expected but was "/\xC2\xA4\xC3\x9B\xC2\xA4\xC2\xB2/\xC2\xA4\xC3\x9B\xC2\xA4\xC2\xB2". Finished tests in 1.592092s, 2.5124 tests/s, 11.3059 assertions/s. 4 tests, 18 assertions, 1 failures, 0 errors, 0 skips ruby -v: ruby 2.0.0dev (2012-10-09 trunk 37127) [i386-mingw32]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Win7 Ultimate 32bit