From 9a6518abf71e5de3d5dee21152dd4cff6730b640 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 24 Jun 2014 02:19:09 +0000 Subject: hash.c: replace undef * hash.c (env_str_new, env_path_str_new): replace invalid or undefined conversions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- hash.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'hash.c') diff --git a/hash.c b/hash.c index 69ffe75b17..7c3ff9831b 100644 --- a/hash.c +++ b/hash.c @@ -2504,7 +2504,9 @@ static VALUE env_str_new(const char *ptr, long len) { #ifdef _WIN32 - VALUE str = rb_str_conv_enc(rb_str_new(ptr, len), rb_utf8_encoding(), rb_locale_encoding()); + VALUE str = rb_str_conv_enc_opts(rb_str_new(ptr, len), + rb_utf8_encoding(), rb_locale_encoding(), + ECONV_INVALID_REPLACE | ECONV_UNDEF_REPLACE, Qnil); #else VALUE str = rb_locale_str_new(ptr, len); #endif @@ -2517,8 +2519,9 @@ static VALUE env_path_str_new(const char *ptr) { #ifdef _WIN32 - VALUE str = rb_enc_str_new_cstr(ptr, rb_utf8_encoding()); - str = rb_str_conv_enc(str, NULL, rb_filesystem_encoding()); + VALUE str = rb_str_conv_enc_opts(rb_str_new_cstr(ptr), + rb_utf8_encoding(), rb_filesystem_encoding(), + ECONV_INVALID_REPLACE | ECONV_UNDEF_REPLACE, Qnil); #else VALUE str = rb_filesystem_str_new_cstr(ptr); #endif -- cgit v1.2.3