aboutsummaryrefslogtreecommitdiffstats
path: root/hash.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-01 15:55:56 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-01 15:55:56 +0000
commit6b1a58b9e6f52d6fbb1eef01cc24cf7be6e3a929 (patch)
tree37c8368bbd4e25e38651248038592d754b13d6d4 /hash.c
parent547bd873d3dbe23231c3cff3337140b9e1821464 (diff)
downloadruby-6b1a58b9e6f52d6fbb1eef01cc24cf7be6e3a929.tar.gz
* hash.c (getenv): use ANSI codepage version of getenv() for miniruby
on Windows. [ruby-core:58732] [Bug #9189] reported by phasis68 (Heesob Park). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/hash.c b/hash.c
index e1d682819e..8ceae61d29 100644
--- a/hash.c
+++ b/hash.c
@@ -2423,7 +2423,17 @@ static char **my_environ;
#undef environ
#define environ my_environ
#undef getenv
-#define getenv(n) rb_w32_ugetenv(n)
+inline char *
+getenv(const char *name)
+{
+ static int binary = -1;
+ static int locale = -1;
+ if (binary < 0) {
+ binary = rb_ascii8bit_encindex();
+ locale = rb_locale_encindex();
+ }
+ return locale == binary ? rb_w32_getenv(name) : rb_w32_ugetenv(name);
+}
#elif defined(__APPLE__)
#undef environ
#define environ (*_NSGetEnviron())