From: 7stud -- Date: 2009-02-25T02:40:51+09:00 Subject: Re: Encoding problem ? in Mechanize /NET::Http.get Adam Cza wrote: > Hi there. > I'm trying to get a site to mess with, using mechanize. > Site charset is iso-8859-2 ... > During the process I get that rather unpleasant error > >>ruby pierdolety.rb > /usr/lib/ruby/gems/1.8/gems/mechanize-0.9.1/lib/www/mechanize/util.rb:29:in > `iconv': "\352"... (Iconv::IllegalSequence) > > from this code > > require 'rubygems' > require 'mechanize' > > agent = WWW::Mechanize.new{ |agent| > agent.user_agent_alias = 'Mac Safari'} > > agent.get('http://www.land-serwis.pl/hurt/zaloguj.php') > > > > > I tried googling it, but It gave Me no effect at all. > > any ideas ? Looking at the source code from that web site, mechanize is having problems with this word: Się The \352 in the error message is an octal number, which is 234 in decimal, which is the decimal code for 'ę' in iso-8859-2. Mechanize is choking on that character. The error message mentions iconv, which is a standard library module used to convert between different encodings. It looks to me like get() is trying to use iconv to convert 'ę' to ascii, which is causing the error. I looked around the Mechanize docs, and I couldn't find any mention of "encoding", so I have no solution. -- Posted via http://www.ruby-forum.com/.