|
Interesting notes;
Ruby 2.4
rb_w32_get_environ https://github.com/ruby/ruby/blob/9db0b2d7eeae0986e79444a8721dc49ec3234aff/win32/win32.c#L6003-L6036
rb_w32_getenv(const char *name) calls w32_getenv(CP_ACP) <--- WHAT THE?
rb_w32_ugetenv https://github.com/ruby/ruby/blob/9db0b2d7eeae0986e79444a8721dc49ec3234aff/win32/win32.c#L5143-L5146
rb_w32_getenv https://github.com/ruby/ruby/blob/9db0b2d7eeae0986e79444a8721dc49ec3234aff/win32/win32.c#L5150-L5153
w32_getenv_unknown() flips encoding (unicode vs cp_acp) based on rb_locale_encindex() == rb_ascii8bit_encindex() https://github.com/ruby/ruby/blob/5ec23b5222811bcbce0b3049d53f89311f6e43b5/hash.c#L3057-L3068
https://github.com/ruby/ruby/blob/5ec23b5222811bcbce0b3049d53f89311f6e43b5/hash.c#L3134-L3142
Ruby 2.3
w32_getenv flips encoding based on rb_locale_encindex being the same as rb_ascii8bit_encindex https://github.com/ruby/ruby/blob/ruby_2_3/hash.c#L2853-L2862
rb_ascii8bit_encindex = ENCINDEX_ASCII https://github.com/ruby/ruby/blob/ruby_2_3/encoding.c#L1313-L1316
rb_locale_encindex https://github.com/ruby/ruby/blob/ruby_2_3/encoding.c#L1351-L1366 defaults to ENCINDEX_ASCII
env_has_key(VALUE env, VALUE key) { const char *s; s = env_name(key); if (getenv(s)) return Qtrue; return Qfalse; }
https://github.com/ruby/ruby/blob/ruby_2_3/hash.c#L3831-L3839
env_name just creates a pointer from a string
getenv is defined as w32_getenv on windows https://github.com/ruby/ruby/blob/ruby_2_3/hash.c#L2863
rb_locale_encindex https://github.com/ruby/ruby/blob/ruby_2_3/encoding.c#L1351-L1366
|