Method: String#force_encoding

Defined in:
string.c

#force_encoding(encoding) ⇒ String

Changes the encoding to encoding and returns self.

Returns:



10384
10385
10386
10387
10388
10389
10390
10391
# File 'string.c', line 10384

static VALUE
rb_str_force_encoding(VALUE str, VALUE enc)
{
    str_modifiable(str);
    rb_enc_associate(str, rb_to_encoding(enc));
    ENC_CODERANGE_CLEAR(str);
    return str;
}