instance method
StringIO#set_encoding_by_bom
strio.set_encoding_by_bom => strio or nil
ext/stringio/stringio.c
View on GitHub ↗
static VALUE
strio_set_encoding_by_bom(VALUE self)
{
struct StringIO *ptr = StringIO(self);
if (!set_encoding_by_bom(ptr)) return Qnil;
return rb_enc_from_encoding(ptr->enc);
}
Sets the encoding according to the BOM (Byte Order Mark) in the string.
Returns self if the BOM is found, otherwise +nil.