summaryrefslogtreecommitdiff
path: root/encoding.c
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2026-01-16 21:15:05 +0100
committerJean Boussier <jean.boussier@gmail.com>2026-01-16 22:44:38 +0100
commit1f3c52dc155fb7fbc42fc8e146924091ba1dfa20 (patch)
tree02ac37df8073c08743e67533322ed1438349813b /encoding.c
parentc56ce8a6c19334265b1a4a64876fffff9b98b2b1 (diff)
Fix rb_interned_str: create strings with BINARY (akak ASCII_8BIT) encoding
[Bug #21842] The documentation always stated as much, and it's consistent with the rb_str_* family of functions.
Diffstat (limited to 'encoding.c')
-rw-r--r--encoding.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/encoding.c b/encoding.c
index 8bb393b471..e9510fe3c1 100644
--- a/encoding.c
+++ b/encoding.c
@@ -1367,7 +1367,7 @@ enc_names_i(st_data_t name, st_data_t idx, st_data_t args)
VALUE *arg = (VALUE *)args;
if ((int)idx == (int)arg[0]) {
- VALUE str = rb_interned_str_cstr((char *)name);
+ VALUE str = rb_enc_interned_str_cstr((char *)name, rb_usascii_encoding());
rb_ary_push(arg[1], str);
}
return ST_CONTINUE;
@@ -1873,7 +1873,7 @@ static int
rb_enc_name_list_i(st_data_t name, st_data_t idx, st_data_t arg)
{
VALUE ary = (VALUE)arg;
- VALUE str = rb_interned_str_cstr((char *)name);
+ VALUE str = rb_enc_interned_str_cstr((char *)name, rb_usascii_encoding());
rb_ary_push(ary, str);
return ST_CONTINUE;
}
@@ -1921,7 +1921,7 @@ rb_enc_aliases_enc_i(st_data_t name, st_data_t orig, st_data_t arg)
str = rb_fstring_cstr(rb_enc_name(enc));
rb_ary_store(ary, idx, str);
}
- key = rb_interned_str_cstr((char *)name);
+ key = rb_enc_interned_str_cstr((char *)name, rb_usascii_encoding());
rb_hash_aset(aliases, key, str);
return ST_CONTINUE;
}