End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Encoding#name
enc.name → string
encoding.c
View on GitHub ↗
static VALUE
enc_name(VALUE self)
{
return rb_fstring_cstr(rb_enc_name((rb_encoding*)DATA_PTR(self)));
}
Alias of #to_s
Returns the name of the encoding.
Example
Encoding::UTF_8.name #=> "UTF-8"