Check if encoding capable object before check if ASCII compatible
This commit is contained in:
parent
d2483393cb
commit
43e8d9a050
Notes:
git
2022-08-20 10:07:01 +09:00
3
string.c
3
string.c
@ -2526,6 +2526,9 @@ void
|
||||
rb_must_asciicompat(VALUE str)
|
||||
{
|
||||
rb_encoding *enc = rb_enc_get(str);
|
||||
if (!enc) {
|
||||
rb_raise(rb_eTypeError, "not encoding capable object");
|
||||
}
|
||||
if (!rb_enc_asciicompat(enc)) {
|
||||
rb_raise(rb_eEncCompatError, "ASCII incompatible encoding: %s", rb_enc_name(enc));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user