Hi. I have a question about parsing and encoding. I tried this out.>> agent = Mechanize.new >> p = agent.get(''http://log.kaist.ac.kr/enc.html'') >> p.forms=> [] However, it has a form. I think the reason is encoding of ''enc.html'' ''enc.html'' is with encoding ''euc-kr'' and it conflicts with the parser. I tried out>> p.encoding = ''utf-8''or>> p.encoding = ''euc-kr''but it doesn''t work. Thank you for reading this email. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/mechanize-users/attachments/20110411/3c3605f4/attachment.html>
On Apr 11, 2011, at 1:06 AM, Minwoo Lee wrote:> Hi. > I have a question about parsing and encoding. > > I tried this out. > > >> agent = Mechanize.new > >> p = agent.get(''http://log.kaist.ac.kr/enc.html'') > >> p.forms > => [] > > However, it has a form. > I think the reason is encoding of ''enc.html'' > > ''enc.html'' is with encoding ''euc-kr'' and it conflicts with the parser. > > I tried out > >> p.encoding = ''utf-8'' > or > >> p.encoding = ''euc-kr'' > but it doesn''t work.This appears to work with the mechanize beta. Try `gem install mechanize --pre` or install from source.
Thank you! Your answer is perfect. I solved the problem. 2011/4/12 Eric Hodel <drbrain at segment7.net>> On Apr 11, 2011, at 1:06 AM, Minwoo Lee wrote: > > > Hi. > > I have a question about parsing and encoding. > > > > I tried this out. > > > > >> agent = Mechanize.new > > >> p = agent.get(''http://log.kaist.ac.kr/enc.html'') > > >> p.forms > > => [] > > > > However, it has a form. > > I think the reason is encoding of ''enc.html'' > > > > ''enc.html'' is with encoding ''euc-kr'' and it conflicts with the parser. > > > > I tried out > > >> p.encoding = ''utf-8'' > > or > > >> p.encoding = ''euc-kr'' > > but it doesn''t work. > > This appears to work with the mechanize beta. Try `gem install mechanize > --pre` or install from source. > _______________________________________________ > Mechanize-users mailing list > Mechanize-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mechanize-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/mechanize-users/attachments/20110414/39b66dea/attachment.html>