Converting character sets
May 26, 2005@hash.iconv!("iso-8859-1", "utf-8")
require 'iconv'
class Hash
def iconv!(to,from)
iconv = Iconv.new(to,from)
perform_iconv!(iconv)
iconv.close
end
def perform_iconv!(iconv)
each_pair do |key,value|
case value
when String
self[key] = iconv.iconv(value)
when Hash
value.perform_iconv!(iconv)
end
end
end
end