Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Encoding#ascii_compatible?
() -> bool
enc.ascii_compatible? → true or false
encoding.c
View on GitHub ↗
static VALUE
enc_ascii_compatible_p(VALUE enc)
{
return RBOOL(rb_enc_asciicompat(must_encoding(enc)));
}
Returns whether ASCII-compatible or not.
Example
Encoding::UTF_8.ascii_compatible? #=> true Encoding::UTF_16BE.ascii_compatible? #=> false