tags:

views:

545

answers:

2

Hello, how to get a list of valid Iconv encodings in Ruby 1.9.1 under windows 7?

A: 

The list is not maintained by Ruby so you can't do it from Ruby. Ruby simply uses whatever iconv you've installed on the system. If you have the full iconv installation, you can get the list from iconv like,

 iconv /l

If you just have the library (iconv.dll), there is no way to get the list.

Most implementation is based on GNU iconv and the list is very static. You can just go to any Linux machine and type "iconv -l" to get the list.

ZZ Coder
I have found that the JRuby implementation of iconv certainly doesn't have the complete list available
Vertis
A: 

Maybe this will help:

puts Encoding.list
puts Encoding.aliases

It returns a list of loaded encodings, and a hash of encoding's aliases:

ASCII-8BIT
UTF-8
US-ASCII
Big5
CP949
Emacs-Mule
EUC-JP
EUC-KR
EUC-TW
...



   {"BINARY"=>"ASCII-8BIT", "CP437"=>"IBM437", "CP737"=>"IBM737", "CP775"=>"IBM775",
 "IBM850"=>"CP850", "CP857"=>"IBM857", "CP860"=>"IBM860", "CP861"=>"IBM861",
 "CP862"=>"IBM862", "CP863"=>"IBM863", "CP864"=>"IBM864", "CP865"=>"IBM865", ... 
Pavel Chernov