diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-09-29 20:01:14 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-10-01 20:28:44 +0900 |
commit | 3e46117d3fb12d1428c97daf9e8d6bce36b90240 (patch) | |
tree | 9e8f1beb8c7e64ce4b79814b87b1c968eefd4b81 /file.c | |
parent | 842b0008c132dd587f09766a228041afb7fed24f (diff) |
Associate the encoding to the found path
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4915
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -6369,6 +6369,10 @@ is_explicit_relative(const char *path) static VALUE copy_path_class(VALUE path, VALUE orig) { + int encidx = rb_enc_get_index(orig); + if (encidx == ENCINDEX_ASCII || encidx == ENCINDEX_US_ASCII) + encidx = rb_filesystem_encindex(); + rb_enc_associate_index(path, encidx); str_shrink(path); RBASIC_SET_CLASS(path, rb_obj_class(orig)); OBJ_FREEZE(path); |