Zach Baker
2006-Dec-30 19:32 UTC
[Mechanize-users] Change I needed to make in to_absolute_uri for unescaped URL separator characters
Mechanize is great! It''s better than anything I was expecting to be out there, and the syntax is really nice. I had a bit of a problem though -- following URLs with commas. The code in to_absolute_uri works great for spaces, but some pages I was working on had URLs with unescaped commas that URI rejected when I tried to click() on them. So I changed the first statement in Mechanize#to_absolute_uri to: url = URI.parse( URI.unescape( Util.html_unescape(url.to_s.strip)).gsub(/[ ,]/){|m| ''%%%X'' % m[0]} ) unless url.is_a? URI I don''t know what a more complete solution for this bug is, but this at least lets me follow the URLs I need to, so here it is if anyone else needs to use it. -- Zach.