Mechanize and encoding

M

Marius Hildebrandt

I'm trying to scrape a page that both HTTP-header and the HMTL document
claim is UTF-8, but all special characters are substituted by a question
mark when I use Mechanize/Hpricot to scrape some accented strings and
save to a local file. I suspect the page is in "ISO-8859-1", but I'm not
sure.

I have tried using the"ruby -Ku" and also the $KCODE='u' option without
success.

How can I force Mechanize to read the doc as "ISO-8859-1"?

I understand that Iconv can convert encoding, but just can't see how I
can use it with Mechanize...

Thanks,
Marius
 
Ø

عمر ملقب بالثانی

I have had exactly the same problem and the same question.

It seems I solve it with $KCODE ='UTF8'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,069
Latest member
SimplyleanKetoReviews

Latest Threads

Top