From b0391268a221f233f098e39e3bc21b8a0888509e Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 6 Aug 2013 08:42:25 +0000 Subject: [PATCH] win32.c: fix conversion * win32/win32.c (rb_w32_conv_from_wchar): converted string to CP_UTF8 should have UTF-8 encoding. otherwise no conversion takes place later. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ win32/win32.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3e20edca7e..e643a13374 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue Aug 6 17:42:21 2013 Nobuyoshi Nakada + + * win32/win32.c (rb_w32_conv_from_wchar): converted string to CP_UTF8 + should have UTF-8 encoding. otherwise no conversion takes place + later. + Tue Aug 6 17:21:38 2013 Koichi Sasada * vm_insnhelper.c (vm_push_frame): fix stack overflow check codes. diff --git a/win32/win32.c b/win32/win32.c index 214713697b..fda9e36af7 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -2053,7 +2053,7 @@ rb_w32_conv_from_wchar(const WCHAR *wstr, rb_encoding *enc) #endif int clen = rb_long2int(len); len = WideCharToMultiByte(CP_UTF8, 0, wstr, clen, NULL, 0, NULL, NULL); - src = rb_enc_str_new(0, len, enc); + src = rb_enc_str_new(0, len, rb_enc_from_index(ENCINDEX_UTF_8)); WideCharToMultiByte(CP_UTF8, 0, wstr, clen, RSTRING_PTR(src), len, NULL, NULL); } switch (encindex) {