Method: IO#internal_encoding

Defined in:
io.c

#internal_encodingEncoding?

Returns the Encoding object that represents the encoding of the internal string, if conversion is specified, or nil otherwise.

See Encodings.

Returns:



13475
13476
13477
13478
13479
13480
13481
13482
# File 'io.c', line 13475

static VALUE
rb_io_internal_encoding(VALUE io)
{
    rb_io_t *fptr = RFILE(rb_io_taint_check(io))->fptr;

    if (!fptr->encs.enc2) return Qnil;
    return rb_enc_from_encoding(io_read_encoding(fptr));
}