in reply to Mechanize Returns Garbled Content

What do you get from
print $m->response->headers->as_string;

Replies are listed 'Best First'.
Re^2: Mechanize Returns Garbled Content
by Anonymous Monk on Jun 28, 2011 at 22:48 UTC
    Both machines returned some header information. On the 'good' machine, it returned this.
    Cache-Control: private, max-age=0 Connection: close Date: Tue, 28 Jun 2011 22:45:06 GMT Server: gws Content-Type: text/html; charset=ISO-8859-1 Expires: -1 Client-Date: Tue, 28 Jun 2011 22:43:19 GMT Client-Peer: xx.xx.xx.xx:80 Client-Response-Num: 1 Set-Cookie: PREF=ID=c390276a4d39152b:FF=0:TM=1309301106:LM=1309301106: +S=OOuAOCNBYRLJCHWp; expires=Thu, 27-Jun-2013 22:45:06 GMT; path=/; do +main=.google.com Set-Cookie: NID=48=H5aMKdl8PlT40vE7xU3rxWQ0Py7lY4AXt8L-BJ9q3ZIp4QN8riF +AnUTh_gYtX6s_dG-pf3FFPKLs1M80BC2z3SDbma5vGWFi_h0wgCmHSbQzCYFW0nD2KoyE +I4FxEukb; expires=Wed, 28-Dec-2011 22:45:06 GMT; path=/; domain=.goog +le.com; HttpOnly Title: Google X-Meta-Description: Search the world's information, including webpages +, images, videos and more. Google has many special features to help y +ou find exactly what you're looking for. X-Meta-Robots: noodp X-XSS-Protection: 1; mode=block
    On the 'bad' machine, it returned this.
    Cache-Control: private, max-age=0 Connection: close Date: Tue, 28 Jun 2011 22:45:19 GMT Server: gws Content-Encoding: gzip Content-Length: 6075 Content-Type: text/html; charset=UTF-8 Expires: -1 Client-Date: Tue, 28 Jun 2011 22:45:19 GMT Client-Peer: xx.xx.xx.xx:80 Client-Response-Num: 1 Set-Cookie: PREF=ID=ee94fe222925b98d:FF=0:TM=1309301119:LM=1309301119: +S=93SJpaSxcxzXIjMh; expires=Thu, 27-Jun-2013 22:45:19 GMT; path=/; do +main=.google.com Set-Cookie: NID=48=Zvuevcb_CgIY6rP-Gq65L1oR6r41cs3nYFNAFNoYfwOqFZxcBhr +bW_x4PTjTfgVmh7fovclmf2dWwJu6F-c6NGvMQhdoASsxN07mlNVP1Pi7XbeL6LeqkhJ9 +Jvy8wCj7; expires=Wed, 28-Dec-2011 22:45:19 GMT; path=/; domain=.goog +le.com; HttpOnly X-XSS-Protection: 1; mode=block
    Both response are different and the 'bad' machine seems to think that the content is gzip?

      Content-Encoding: gzip accounts for the garbling, but WWW::Mechanize uses ->decoded_content to handle that. Try upgrading

      • WWW::Mechanize
      • IO::Uncompress::Gunzip
      • HTTP::Message

        Try upgrading

        Doh, I can't believe I'd guess that some type of network thingamabob would be the culprit before this. I hope I remember that next time...

      "Line 5 from the good machine: Content-Type: text/html; charset=ISO-8859-1
      Line 7 from the "bad" machine: Content-Type: text/html; charset=UTF-8
      "

      Could the bolded difference make a difference?

        How would I tell the "bad" machine to use charset=ISO-88590-1? Do you think this would work?
        $m->add_header( charset => 'ISO-8859-1' );