GaijinPunch has asked for the wisdom of the Perl Monks concerning the following question:

Got a head-scratcher here.

I recently did a system update (Gentoo: emerge world) which broke a ton of crap, but I think I've got most of it sorted out. One thing I've not been able to figure out though is that a couple of scripts that used to work fine with WWW::Mechanize are now broken. The symptom is that the pages (which are euc-jp) are stored in utf8. (The HTML tag of course still says euc-jp, but it's mojibake when I view the page unless I chage it to unicode).

I had no other modules that did any of conversion, and confirmed that even the simplest of the few scripts I have output utf8. I can use Jcode to convert them back to euc easily enough... but I still want to know why.

No need to rack any brains on this one, but I find it quite silly.

Replies are listed 'Best First'.
Re: Mechanize forcing utf8
by Corion (Patriarch) on Dec 02, 2008 at 08:26 UTC

    Since a few versions ago (1.49+), WWW::Mechanize (Changes) decodes the content itself, so if you decoded the content manually before, that will break. I don't know which versions you had before, but if it was lower and now is higher that will explain the difference.

      Cheers -- I'll go with that. I took a quick look at Mechanize's page, but didn't see anything about utf8 specifically. Anyways, at least I know how to tackle the problem now.