summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-24 02:19:09 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-24 02:19:09 +0000
commit9a6518abf71e5de3d5dee21152dd4cff6730b640 (patch)
tree8c25cef29b511565fe13733509c0fa759f850137
parentbc7919a9cd5f521a6c901000bf9f6055018a0cf4 (diff)
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
-rw-r--r--hash.c9
1 files changed, 6 insertions, 3 deletions
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