I am looking for help debugging Mechanize. When I navigate to a page and attempt to call .read(), I get non-unicode result about 1 out of every 5 or so attempts. The non-unicode result looks like the following:
úRW!¤cêLÒ0T¸²ÖþF\<äs
+€²Ü@9‚ÈøMq1;=®}ÿ½8¹WP[ëæåñ±øþûÚc!ˆÍzòØåŸ¿þUüþf>àSÕ‹‚~é÷bƪ}Ãp#',®ˆâËýÊæÚ³õµÊZñMyô‘;–sä„IWÍÞ·mwx¨|ýHåÀ½A ºÒòÀö QNqÒ4O{Žë+óZu"úÒ¸½vº³ÔP”º‘cÇ—Êâ#<31{HiºF4N¨ÂÀ”Û´>•ŠÜÅò€U±§¶8ÑWEú(ƒ‘cÀWÄ~‡ ‡—¯J$ÁvQìfj²a$DdªÐŠÐ5[ü(4` ŒÛ”–<‹eñƒ(‚¹=[U¤#íQhÉÔô6(î$M ²-Õ£›Œndû8mØïõ7;”¨zÒ€F°¬@Xˆ€*õ䊈xŸÊ%úÅò= kôc¡¢ØyœÑy³í>ËÜ-¥m+ßê¸ïmì Ycãa®-Ø•†ê¸îmq«x} i¥GEŽj]ÏëUÆËGS°êõ½AxwÕµêúR¶à|ôO¹ýüà:S¸S‡®U%}•Cî3ãg~QÛó´Ó]ïn[FwuCm6žš[«J®™›Ý-£A˜Ö€sµ1khí””/\S~u£C7²Í#wÑ»@ç@sô,ÆQèÊôó®.ä(å*æ‡#÷»’õµ{à˜Õ„SÒ%@ˆtL †¸±¹åI{„Õv#³ëŠUG…s‡•·Aíí»8¡Ò|Ö«à4€¼dˆ¸—áÐåqA‘ï $Õ[NØÖ£o\s£Z_¾^ Äóo~?<Ú¿Ùÿ]À@@bÈ%¶Á$¦G oË·ò}[µ+>ðµ°Íöе?R1úQ–&PãýT¥¢ði+|óf«ú,â,ÛQ㤚ӢÏìÙT£šÚA䡳£
I have tried the normal Mechanize parser (mechanize.Browser()) as well as the commonly suggested alternative (factory=mechanize.RobustFactory()).
Any suggestions for next steps?
Problem solved:
If you are getting similar output, check the page headers as it is probably gzipped after instantiating the browser set
set_handle_gzip(True)