diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-10 08:24:36 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-10 08:24:36 +0000 |
commit | 6ccf3d68c21c2eabefe80f9ff1f7b5296a9ddfd2 (patch) | |
tree | d4067ab10ba5b3b857388b3e7f2dbb69e4d41c8f /win32 | |
parent | e899fb19e9a845108c264ecc0e0542d68ce97fe7 (diff) |
win32.c: login name encoding
* ext/etc/etc.c (etc_getlogin): set login name encoding properly.
[ruby-core:66163] [Bug #10493]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r-- | win32/win32.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/win32/win32.c b/win32/win32.c index 61872e997a..9f80d3228d 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -546,11 +546,12 @@ init_env(void) if (!GetEnvironmentVariableW(L"USERNAME", env, numberof(env)) && !GetUserNameW(env, (len = numberof(env), &len))) { NTLoginName = "<Unknown>"; - return; } - set_env_val(L"USER"); + else { + set_env_val(L"USER"); + NTLoginName = rb_w32_wstr_to_mbstr(CP_UTF8, env, -1, NULL); + } } - NTLoginName = strdup(rb_w32_getenv("USER")); if (!GetEnvironmentVariableW(TMPDIR, env, numberof(env)) && !GetEnvironmentVariableW(L"TMP", env, numberof(env)) && |