1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2013-08-06 08:42:25 +00:00
parent 22468a4f92
commit b0391268a2
2 changed files with 7 additions and 1 deletions

View file

@ -1,3 +1,9 @@
Tue Aug 6 17:42:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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 <ko1@atdot.net> Tue Aug 6 17:21:38 2013 Koichi Sasada <ko1@atdot.net>
* vm_insnhelper.c (vm_push_frame): fix stack overflow check codes. * vm_insnhelper.c (vm_push_frame): fix stack overflow check codes.

View file

@ -2053,7 +2053,7 @@ rb_w32_conv_from_wchar(const WCHAR *wstr, rb_encoding *enc)
#endif #endif
int clen = rb_long2int(len); int clen = rb_long2int(len);
len = WideCharToMultiByte(CP_UTF8, 0, wstr, clen, NULL, 0, NULL, NULL); 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); WideCharToMultiByte(CP_UTF8, 0, wstr, clen, RSTRING_PTR(src), len, NULL, NULL);
} }
switch (encindex) { switch (encindex) {