summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'hash.c')
-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