H
Horacio Sanson
I am trying to convert some text data read from a web page from one charset to
UTF-8 using Iconv but I am getting an IllegalSequence all the time.
I wrote a little script that reads a web page via Net::HTTP, after that I
simply pass the body of the web page to Iconv like this:
h = Net::HTTP.new(@uri.host,@uri.port)
@resp, @body = h.get(@uri.path, nil )
puts "Code = #{@resp.code}"
puts "Message = #{@resp.message}"
@resp.each {|key, val| printf "%-14s = %-40.40s\n", key, val }
#puts @body
puts Iconv.new("sjis", "utf8").iconv(@body)
when running this script I get
`iconv': "\223\374\216D\214\366\215\220" (Iconv::IllegalSequence)
I can use the iconv command line and I get the desired result... is Iconv
working properly? I am doing something wrong? or is there any other way to do
this??
thanks for any tips
Horacio
UTF-8 using Iconv but I am getting an IllegalSequence all the time.
I wrote a little script that reads a web page via Net::HTTP, after that I
simply pass the body of the web page to Iconv like this:
h = Net::HTTP.new(@uri.host,@uri.port)
@resp, @body = h.get(@uri.path, nil )
puts "Code = #{@resp.code}"
puts "Message = #{@resp.message}"
@resp.each {|key, val| printf "%-14s = %-40.40s\n", key, val }
#puts @body
puts Iconv.new("sjis", "utf8").iconv(@body)
when running this script I get
`iconv': "\223\374\216D\214\366\215\220" (Iconv::IllegalSequence)
I can use the iconv command line and I get the desired result... is Iconv
working properly? I am doing something wrong? or is there any other way to do
this??
thanks for any tips
Horacio