End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
StringIO#external_encoding
strio.external_encoding => encoding
ext/stringio/stringio.c
View on GitHub ↗
static VALUE
strio_external_encoding(VALUE self)
{
struct StringIO *ptr = StringIO(self);
return rb_enc_from_encoding(get_enc(ptr));
}
Returns the Encoding object that represents the encoding of the file. If the stream is write mode and no encoding is specified, returns nil.