instance method
String#encode!
(?::encoding source_encoding, ?::encoding? from_encoding, ?invalid: :replace ?, ?undef: :replace ?, ?replace: ::string?, ?xml: (:text | :attr)?, ?newline: (:universal | :crlf | :cr | :lf)?, ?universal_newline: ::boolish, ?cr_newline: ::boolish, ?crlf_newline: ::boolish, ?lf_newline: ::boolish, ?fallback: ^(::String) -> ::string? | ::Method | ::String::_EncodeFallbackAref) -> self
encode!(dst_encoding = Encoding.default_internal, **enc_opts) → self
encode!(dst_encoding, src_encoding, **enc_opts) → self
transcode.c
View on GitHub ↗
static VALUE
str_encode_bang(int argc, VALUE *argv, VALUE str)
{
VALUE newstr;
int encidx;
rb_check_frozen(str);
newstr = str;
encidx = str_transcode(argc, argv, &newstr);
if (encidx < 0) return str;
if (newstr == str) {
rb_enc_associate_index(str, encidx);
return str;
}
rb_str_shared_replace(str, newstr);
return str_encode_associate(str, encidx);
}