* win32/win32.c (rb_w32_conv_from_wchar): use ECONV_UNDEF_REPLACE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7e7420cc85
commit
414727ca70
@ -1818,9 +1818,6 @@ rb_w32_conv_from_wchar(const WCHAR *wstr, rb_encoding *enc)
|
|||||||
{
|
{
|
||||||
static rb_encoding *utf16 = (rb_encoding *)-1;
|
static rb_encoding *utf16 = (rb_encoding *)-1;
|
||||||
VALUE src;
|
VALUE src;
|
||||||
VALUE opthash;
|
|
||||||
int ecflags;
|
|
||||||
VALUE ecopts;
|
|
||||||
|
|
||||||
if (utf16 == (rb_encoding *)-1) {
|
if (utf16 == (rb_encoding *)-1) {
|
||||||
utf16 = rb_enc_find("UTF-16LE");
|
utf16 = rb_enc_find("UTF-16LE");
|
||||||
@ -1832,11 +1829,7 @@ rb_w32_conv_from_wchar(const WCHAR *wstr, rb_encoding *enc)
|
|||||||
return Qnil;
|
return Qnil;
|
||||||
|
|
||||||
src = rb_enc_str_new((char *)wstr, lstrlenW(wstr) * sizeof(WCHAR), utf16);
|
src = rb_enc_str_new((char *)wstr, lstrlenW(wstr) * sizeof(WCHAR), utf16);
|
||||||
opthash = rb_hash_new();
|
return rb_str_encode(src, rb_enc_from_encoding(enc), ECONV_UNDEF_REPLACE, Qnil);
|
||||||
rb_hash_aset(opthash, ID2SYM(rb_intern("undef")),
|
|
||||||
ID2SYM(rb_intern("replace")));
|
|
||||||
ecflags = rb_econv_prepare_opts(opthash, &ecopts);
|
|
||||||
return rb_str_encode(src, rb_enc_from_encoding(enc), ecflags, ecopts);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
Loading…
x
Reference in New Issue
Block a user