Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

StringIO#set_encoding

strio.set_encoding(ext_enc, [int_enc[, opt]]) => strio

Specify the encoding of the StringIO as ext_enc. Use the default external encoding if ext_enc is nil. 2nd argument int_enc and optional hash opt argument are ignored; they are for API compatibility to IO.

See also #seek #set_encoding_by_bom #rewind #size also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1