diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-30 01:59:07 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-30 01:59:07 +0000 |
commit | dc0b06aa38ceb64d326b5e6e24a380040e730df2 (patch) | |
tree | 8136a140e4d4e12830f6b8495b33a65c5a37fcf2 /win32/win32.c | |
parent | 64d39448d3ece0367a8ed2b94fd72b91895c34b6 (diff) |
win32.c: UTF-8 spawn
* win32/win32.c (w32_spawn): extract codepage aware code from
rb_w32_spawn().
* win32/win32.c (rb_w32_uspawn): add UTF-8 version function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32/win32.c')
-rw-r--r-- | win32/win32.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/win32/win32.c b/win32/win32.c index b1780c2be1..39b89a3a9d 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -1180,7 +1180,7 @@ static char *wstr_to_mbstr(UINT, const WCHAR *, int, long *); /* License: Artistic or GPL */ rb_pid_t -rb_w32_spawn(int mode, const char *cmd, const char *prog) +w32_spawn(int mode, const char *cmd, const char *prog, UINT cp) { char fbuf[MAXPATHLEN]; char *p = NULL; @@ -1270,10 +1270,9 @@ rb_w32_spawn(int mode, const char *cmd, const char *prog) } } - /* assume ACP */ - if (!e && cmd && !(wcmd = acp_to_wstr(cmd, NULL))) e = E2BIG; + if (!e && cmd && !(wcmd = mbstr_to_wstr(cp, cmd, -1, NULL))) e = E2BIG; if (v) ALLOCV_END(v); - if (!e && shell && !(wshell = acp_to_wstr(shell, NULL))) e = E2BIG; + if (!e && shell && !(wshell = mbstr_to_wstr(cp, shell, -1, NULL))) e = E2BIG; if (v2) ALLOCV_END(v2); if (!e) { @@ -1285,6 +1284,21 @@ rb_w32_spawn(int mode, const char *cmd, const char *prog) return ret; } +/* License: Ruby's */ +rb_pid_t +rb_w32_spawn(int mode, const char *cmd, const char *prog) +{ + /* assume ACP */ + return w32_spawn(mode, cmd, prog, filecp()); +} + +/* License: Ruby's */ +rb_pid_t +rb_w32_uspawn(int mode, const char *cmd, const char *prog) +{ + return w32_spawn(mode, cmd, prog, CP_UTF8); +} + /* License: Artistic or GPL */ rb_pid_t w32_aspawn_flags(int mode, const char *prog, char *const *argv, DWORD flags, UINT cp) |