Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
IO#internal_encoding
() -> ::Encoding
internal_encoding → encoding or nil
io.c
View on GitHub ↗
static VALUE
rb_io_internal_encoding(VALUE io)
{
rb_io_t *fptr = rb_io_get_fptr(rb_io_taint_check(io));
if (!fptr->encs.enc2) return Qnil;
return rb_enc_from_encoding(io_read_encoding(fptr));
}