Ruby: List Encodings

By Xah Lee. Date: .

You can print all supported encoding like this:

ruby

Encoding.list.each { |xx| p xx.name}

# "ASCII-8BIT"
# "UTF-8"
# "US-ASCII"
# "UTF-16BE"
# "UTF-16LE"
# "UTF-32BE"
# "UTF-32LE"
# "UTF-16"
# "UTF-32"
# "UTF8-MAC"
# "EUC-JP"
# "Windows-31J"
# "Big5"
# "Big5-HKSCS"
# "Big5-UAO"
# "CESU-8"
# "CP949"
# "Emacs-Mule"
# "EUC-KR"
# "EUC-TW"
# "GB18030"
# "GBK"
# "ISO-8859-1"
# "ISO-8859-2"
# "ISO-8859-3"
# "ISO-8859-4"
# "ISO-8859-5"
# "ISO-8859-6"
# "ISO-8859-7"
# "ISO-8859-8"
# "ISO-8859-9"
# "ISO-8859-10"
# "ISO-8859-11"
# "ISO-8859-13"
# "ISO-8859-14"
# "ISO-8859-15"
# "ISO-8859-16"
# "KOI8-R"
# "KOI8-U"
# "Shift_JIS"
# "Windows-1250"
# "Windows-1251"
# "Windows-1252"
# "Windows-1253"
# "Windows-1254"
# "Windows-1257"
# "IBM437"
# "IBM720"
# "IBM737"
# "IBM775"
# "CP850"
# "IBM852"
# "CP852"
# "IBM855"
# "CP855"
# "IBM857"
# "IBM860"
# "IBM861"
# "IBM862"
# "IBM863"
# "IBM864"
# "IBM865"
# "IBM866"
# "IBM869"
# "Windows-1258"
# "GB1988"
# "macCentEuro"
# "macCroatian"
# "macCyrillic"
# "macGreek"
# "macIceland"
# "macRoman"
# "macRomania"
# "macThai"
# "macTurkish"
# "macUkraine"
# "CP950"
# "CP951"
# "IBM037"
# "stateless-ISO-2022-JP"
# "eucJP-ms"
# "CP51932"
# "EUC-JIS-2004"
# "GB2312"
# "GB12345"
# "ISO-2022-JP"
# "ISO-2022-JP-2"
# "CP50220"
# "CP50221"
# "Windows-1256"
# "Windows-1255"
# "TIS-620"
# "Windows-874"
# "MacJapanese"
# "UTF-7"
# "UTF8-DoCoMo"
# "SJIS-DoCoMo"
# "UTF8-KDDI"
# "SJIS-KDDI"
# "ISO-2022-JP-KDDI"
# "stateless-ISO-2022-JP-KDDI"
# "UTF8-SoftBank"
# "SJIS-SoftBank"

Ruby: Char Encoding