[Bps-public-commit] r20038 - in Net-Google-Code/trunk: lib/Net/Google/Code/Issue lib/Net/Google/Code/Role

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Jun 22 21:42:35 EDT 2009


Author: sunnavy
Date: Mon Jun 22 21:42:34 2009
New Revision: 20038

Modified:
   Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Search.pm
   Net-Google-Code/trunk/lib/Net/Google/Code/Role/Fetchable.pm
   Net-Google-Code/trunk/t/02.issue.t

Log:
replace Encode::decode with conservative utf8::downgrade. we should allow the decode failure: world is complex

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Search.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Search.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Search.pm	Mon Jun 22 21:42:34 2009
@@ -7,7 +7,6 @@
 with 'Net::Google::Code::Role::Pageable';
 with  'Net::Google::Code::Role::HTMLTree';
 use Net::Google::Code::Issue;
-use Encode;
 
 our %CAN_MAP = (
     'all'    => 1,
@@ -97,7 +96,8 @@
     die "Server threw an error " . $mech->response->status_line . 'when search'
       unless $mech->response->is_success;
 
-    my $content = decode( 'utf8', $mech->response->content );
+    my $content = $mech->response->content;
+    utf8::downgrade( $content, 1 );
 
     if ( $mech->title =~ /issue\s+(\d+)/i ) {
 

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Role/Fetchable.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Role/Fetchable.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Role/Fetchable.pm	Mon Jun 22 21:42:34 2009
@@ -2,7 +2,6 @@
 use Any::Moose 'Role';
 use Params::Validate ':all';
 use WWW::Mechanize;
-use Encode;
 
 our $MECH;
 

Modified: Net-Google-Code/trunk/t/02.issue.t
==============================================================================
--- Net-Google-Code/trunk/t/02.issue.t	(original)
+++ Net-Google-Code/trunk/t/02.issue.t	Mon Jun 22 21:42:34 2009
@@ -10,8 +10,8 @@
 use FindBin qw/$Bin/;
 use File::Slurp;
 
-use Encode;
-my $content = decode( 'utf8', read_file( "$Bin/sample/02.issue.html" ));
+my $content = read_file( "$Bin/sample/02.issue.html" );
+utf8::downgrade( $content, 1 );
 
 my $mock = Test::MockModule->new('Net::Google::Code::Issue');
 $mock->mock(
@@ -96,8 +96,8 @@
 is( $issue->updated, '2008-12-20T00:59:29', 'updated' );
 
 
-$content =
-  decode( 'utf8', read_file("$Bin/sample/02.issue_without_attachments.html") );
+$content = read_file("$Bin/sample/02.issue_without_attachments.html");
+utf8::downgrade( $content, 1 );
 $issue->load(14);
 is( $issue->updated, '2008-12-20T00:59:29', 'updated' );
 is_deeply( $issue->attachments, [], 'no attachments are extracted' );



More information about the Bps-public-commit mailing list