| Class | Encoding |
| In: |
encoding.c
|
| Parent: | Object |
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"}
Checks the compatibility of two strings. If they are compatible, means concatenatable, returns an encoding which the concatinated string will be. If they are not compatible, nil is returned.
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("euc-jp"))
=> nil
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)>]
Returns the locale charmap name.
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"
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
ruby-doc.org is a service of James Britt and Happy Camper Studios, a Ruby application development company in Phoenix, AZ.
Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.
For more information on the Ruby programming language, visit ruby-lang.org.
Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.