xmltv/grab Get_nice.pm,1.30,1.31

Nick Morrott <[email protected]> Sun, 28 Jun 2015 08:38:07 +0000
Newsgroups gmane.comp.tv.xmltv.cvs
Message-ID <[email protected]>
Update of /cvsroot/xmltv/xmltv/grab
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv24024/grab

Modified Files:
	Get_nice.pm 
Log Message:
We still need to decode raw octets (default to UTF-8) if new optional decode charset not given.

Index: Get_nice.pm
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/Get_nice.pm,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** Get_nice.pm	22 Feb 2015 15:55:31 -0000	1.30
--- Get_nice.pm	28 Jun 2015 08:38:05 -0000	1.31
***************
*** 39,42 ****
--- 39,43 ----
  use base 'Exporter';
  our @EXPORT = qw(get_nice get_nice_tree get_nice_xml get_nice_json error_msg);
+ use Encode qw(decode);
  use LWP::UserAgent;
  use XMLTV;
***************
*** 79,85 ****
      $content = $filter->($content) if $filter;
      if ($codepage) {
!       # (note: HTML::Parser->utf8_mode is only available Perl 5.8) 
!       require Encode; import Encode;
!       $content = decode($codepage, $content);
      }
      my $t = HTML::TreeBuilder->new();
--- 80,87 ----
      $content = $filter->($content) if $filter;
      if ($codepage) {
!         $content = decode($codepage, $content);
!     }
!     else {
!         $content = decode('UTF-8', $content);
      }
      my $t = HTML::TreeBuilder->new();
***************
*** 102,108 ****
      $content = $filter->($content) if $filter;
      if ($codepage) {
-       require Encode; import Encode;
        $content = decode($codepage, $content);
      }
      my $t = XML::Parser->new(Style => 'Tree')->parse($content) or die "cannot parse content of $uri\n";
      return $t;
--- 104,112 ----
      $content = $filter->($content) if $filter;
      if ($codepage) {
        $content = decode($codepage, $content);
      }
+     else {
+       $content = decode('UTF-8', $content);
+     }
      my $t = XML::Parser->new(Style => 'Tree')->parse($content) or die "cannot parse content of $uri\n";
      return $t;


------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o