The version requirement for this dependency request
If the stream begins with a BOM (byte order marker), consumes the BOM and sets the external encoding accordingly; returns the result encoding if found, or nil
otherwise:
File.write('t.tmp', "\u{FEFF}abc") io = File.open('t.tmp', 'rb') io.set_encoding_by_bom # => #<Encoding:UTF-8> io.close File.write('t.tmp', 'abc') io = File.open('t.tmp', 'rb') io.set_encoding_by_bom # => nil io.close
Raises an exception if the stream is not binmode or its encoding has already been set.
Returns true, if circular data structures should be checked, otherwise returns false.
Sets the encoding to be used for the response body; returns the encoding.
The given value
may be:
An Encoding
object.
The name of an encoding.
An alias for an encoding name.
See Encoding
.
Examples:
http = Net::HTTP.new(hostname) http.response_body_encoding = Encoding::US_ASCII # => #<Encoding:US-ASCII> http.response_body_encoding = 'US-ASCII' # => "US-ASCII" http.response_body_encoding = 'ASCII' # => "ASCII"
def forced_utf8_encoding?: () -> bool
def forced_binary_encoding?: () -> bool
def forced_utf8_encoding?: () -> bool
def forced_binary_encoding?: () -> bool
def forced_utf8_encoding?: () -> bool
def forced_binary_encoding?: () -> bool
def forced_utf8_encoding?: () -> bool
def forced_binary_encoding?: () -> bool
def forced_utf8_encoding?: () -> bool
def forced_binary_encoding?: () -> bool
def forced_utf8_encoding?: () -> bool
def forced_binary_encoding?: () -> bool
def forced_utf8_encoding?: () -> bool
def forced_binary_encoding?: () -> bool