print WWW::Mechanize content (whether in utf8 or not) to file

[email protected] (Peng Yu) Thu, 18 Aug 2011 20:51:21 -0500
Newsgroups perl.libwww
Message-ID <CABrM6w=RHJEG6a4fvUKcVtt+UVLSh+gVZqP+ugkELKqmxnR2=g@mail.gmail.com>
Hi,

$browser is an object of WWW::Mechanize. I'm do not completely
understand the differences between different charsets. But I'm
wondering if I should always check the charset in the header of an
HTTP response to determine what binmode FILE should be. Or it is safe
to always use ":utf8"?

  open FILE,">$content_file";
  binmode FILE, ':utf8';
  print FILE $browser->content;
  close FILE;

-- 
Regards,
Peng