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.

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

list

Encoding.list â [enc1, enc2, ...] Class Public methods Returns the list of loaded encodings. Encoding.list #=> [#<Encoding:ASCII-8BIT>, #<Encoding:UTF-8>, #<Encoding:ISO-2022-JP (dummy)>] Encoding.find("US-ASCII") #=> #<Encoding:US-ASCII> Encoding.list #=> [#<Encoding:ASCII-8BIT>, #<Encoding:UTF-8>, #<Encoding:US-ASCII>, #<Encoding:ISO-2022-JP (dummy)>]

locale_charmap

Encoding.locale_charmap â string Class Public methods Returns the locale charmap name. It returns nil if no appropriate information. Debian GNU/Linux LANG=C Encoding.locale_charmap #=> "ANSI_X3.4-1968" LANG=ja_JP.EUC-JP Encoding.locale_charmap #=> "EUC-JP" SunOS 5 LANG=C Encoding.locale_charmap #=> "646" LANG=ja Encoding.locale_charmap #=> "eucJP" The result is highly platform dependent. So ::find may cause an error. If you need some encod

name_list

Encoding.name_list â ["enc1", "enc2", ...] Class Public methods Returns the list of available encoding names. Encoding.name_list #=> ["US-ASCII", "ASCII-8BIT", "UTF-8", "ISO-8859-1", "Shift_JIS", "EUC-JP", "Windows-31J", "BINARY", "CP932", "eucJP"]

ascii_compatible?

enc.ascii_compatible? â true or false Instance Public methods Returns whether ASCII-compatible or not. Encoding::UTF_8.ascii_compatible? #=> true Encoding::UTF_16BE.ascii_compatible? #=> false

dummy?

enc.dummy? â true or false Instance Public methods Returns true for dummy encodings. A dummy encoding is an encoding for which character handling is not properly implemented. It is used for stateful encodings. Encoding::ISO_2022_JP.dummy? #=> true Encoding::UTF_8.dummy? #=> false

inspect

enc.inspect â string Instance Public methods Returns a string which represents the encoding for programmers. Encoding::UTF_8.inspect #=> "#<Encoding:UTF-8>" Encoding::ISO_2022_JP.inspect #=> "#<Encoding:ISO-2022-JP (dummy)>"

name

enc.name â string Instance Public methods Returns the name of the encoding. Encoding::UTF_8.name #=> "UTF-8"

names

enc.names â array Instance Public methods Returns the list of name and aliases of the encoding. Encoding::WINDOWS_31J.names #=> ["Windows-31J", "CP932", "csWindows31J"]