Mechanize encoding problem with GBK

I tried to use Mechanize for fetching data in a restricted site, but response html with GBK encoding is overwhelm me.

Complicated Wikipedia Scripts Management

After MediaWiki 1.23/wmf3 had been deployed to all Wikimedia sites, old collapse element didn’t work any more on zhwikipedia. The administrator Liangent deleted the old(2009 or even before)  code using pure JavaScript API on MediaWiki:Common.js. Then we tried to solve these mess.