Skip to content
class method

Encoding.locale_charmap

() -> ::String
Encoding.locale_charmap → string

Returns the locale charmap name. It returns nil if no appropriate information.

Example
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 Encoding.find(Encoding.locale_charmap) may cause an error. If you need some encoding object even for unknown locale, Encoding.find(“locale”) can be used.

See also .list .name_list .find #ascii_compatible? also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0