mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Associate the encoding to the found path
This commit is contained in:
parent
842b0008c1
commit
3e46117d3f
Notes:
git
2021-10-01 20:29:13 +09:00
1 changed files with 4 additions and 0 deletions
4
file.c
4
file.c
|
@ -6369,6 +6369,10 @@ is_explicit_relative(const char *path)
|
||||||
static VALUE
|
static VALUE
|
||||||
copy_path_class(VALUE path, VALUE orig)
|
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);
|
str_shrink(path);
|
||||||
RBASIC_SET_CLASS(path, rb_obj_class(orig));
|
RBASIC_SET_CLASS(path, rb_obj_class(orig));
|
||||||
OBJ_FREEZE(path);
|
OBJ_FREEZE(path);
|
||||||
|
|
Loading…
Add table
Reference in a new issue