In some cases when I use open
to get a web page in Ruby the content of the page has an encoding error. Example:
open("http://www.google.com.br").read
Chars like ç
and ã
are replaced by ?
How can I get the right chars?
this seems to work:
require 'iconv'
i = Iconv.new('UTF-8','LATIN1')
i.iconv(open('http://google.com.br').read)