find

Encoding.find(string) â enc Class Public methods Search the encoding with specified name. name should be a string. Encoding.find("US-ASCII") #=> #<Encoding:US-ASCII> Names which this method accept are encoding names and aliases including following special aliases âexternalâ default external encoding âinternalâ default internal encoding âlocaleâ locale encoding âfilesystemâ filesystem encoding An ArgumentError is raised when no encoding with name. Only Enco

default_internal=

Encoding.default_internal = enc or nil Class Public methods Sets default internal encoding or removes default internal encoding when passed nil. You should not set ::default_internal in ruby code as strings created before changing the value may have a different encoding from strings created after the change. Instead you should use ruby -E to invoke ruby with the correct default_internal. See ::default_internal for information on how the default internal encoding is used.

default_internal

Encoding.default_internal â enc Class Public methods Returns default internal encoding. Strings will be transcoded to the default internal encoding in the following places if the default internal encoding is not nil: CSV Etc.sysconfdir and Etc.systmpdir File data read from disk File names from Dir Integer#chr String#inspect and Regexp#inspect Strings returned from Curses Strings returned from Readline Strings returned from SDBM Time#zone Values from ENV Val

default_external=

Encoding.default_external = enc Class Public methods Sets default external encoding. You should not set ::default_external in ruby code as strings created before changing the value may have a different encoding from strings created after the value was changed., instead you should use ruby -E to invoke ruby with the correct default_external. See ::default_external for information on how the default external encoding is used.

default_external

Encoding.default_external â enc Class Public methods Returns default external encoding. The default external encoding is used by default for strings created from the following locations: CSV File data read from disk SDBM StringIO Zlib::GzipReader Zlib::GzipWriter String#inspect Regexp#inspect While strings created from these locations will have this encoding, the encoding may not be valid. Be sure to check String#valid_encoding?. File data written to disk will b

compatible?

Encoding.compatible?(obj1, obj2) â enc or nil Class Public methods Checks the compatibility of two objects. If the objects are both strings they are compatible when they are concatenatable. The encoding of the concatenated string will be returned if they are compatible, nil if they are not. Encoding.compatible?("\xa1".force_encoding("iso-8859-1"), "b") #=> #<Encoding:ISO-8859-1> Encoding.compatible?( "\xa1".force_encoding("iso-8859-1"), "\xa1\xa1".force_encoding("eu

aliases

Encoding.aliases â {"alias1" => "orig1", "alias2" => "orig2", ...} Class Public methods Returns the hash of available encoding alias and original encoding name. Encoding.aliases #=> {"BINARY"=>"ASCII-8BIT", "ASCII"=>"US-ASCII", "ANSI_X3.4-1986"=>"US-ASCII", "SJIS"=>"Shift_JIS", "eucJP"=>"EUC-JP", "CP932"=>"Windows-31J"}

source_encoding_name

ecerr.source_encoding_name â string Instance Public methods Returns the source encoding name as a string.

source_encoding

ecerr.source_encoding â encoding Instance Public methods Returns the source encoding as an encoding object. Note that the result may not be equal to the source encoding of the encoding converter if the conversion has multiple steps. ec = Encoding::Converter.new("ISO-8859-1", "EUC-JP") # ISO-8859-1 -> UTF-8 -> EUC-JP begin ec.convert("\xa0") # NO-BREAK SPACE, which is available in UTF-8 but not in EUC-JP. rescue Encoding::UndefinedConversionError p $!.source_

error_char

ecerr.error_char â string Instance Public methods Returns the one-character string which cause Encoding::UndefinedConversionError. ec = Encoding::Converter.new("ISO-8859-1", "EUC-JP") begin ec.convert("\xa0") rescue Encoding::UndefinedConversionError puts $!.error_char.dump #=> "\xC2\xA0" p $!.error_char.encoding #=> #<Encoding:UTF-8> end