Andy Baugh 6 rokov pred
rodič
commit
bb3f7febce

+ 1 - 1
Makefile

@@ -63,7 +63,7 @@ depend-xmpp:
 	perl -MNet::XMPP -MMozilla::CA -e 'exit 0;' || sudo cpan -i Net::XMPP Mozilla::CA
 
 depend-notification-center:
-	perl -MFile::Slurper -e 'exit 0;' || sudo cpan -i File::Slurper
+	perl -MFile::Slurper -MJSON::MaybeXS -e 'exit 0;' || sudo cpan -i File::Slurper JSON::MaybeXS
 
 depend-all: depend-xmpp depend-irc depend-notification-center
 

+ 3 - 6
lib/Cpanel/iContact/Provider/Local.pm

@@ -68,10 +68,6 @@ sub send {
 	my $html    = ${ $args_hr->{'html_body'} };
 	$html =~ s:src=".*":src="/unprotected/cpanel/images/cp-logo.svg" style="width\:3rem":;
 
-	require Text::Iconv;
-	my $converter = Text::Iconv->new("UTF-8", "ASCII");
-	$html = $converter->convert($html);
-
     # Send it
     my $time = time;
     $time =~ tr/ /-/;
@@ -89,9 +85,10 @@ sub send {
                 };
             }
         }
-	    require Cpanel::AdminBin::Serializer;
+	    require JSON::MaybeXS;
         require File::Slurper;
-        File::Slurper::write_binary( $file, Cpanel::AdminBin::Serializer::Dump( { 'subject' => $subject, 'text' => $text, 'html' => $html } ) );
+		my $encoder = JSON::MaybeXS->new( utf8 => 1 );
+        File::Slurper::write_binary( $file, $encoder->encode( { 'subject' => $subject, 'text' => $text, 'html' => $html } ) );
     }
     catch {
         require Cpanel::Exception;

+ 3 - 2
lib/Cpanel/iContact/Provider/Local/Getter.pm

@@ -5,7 +5,7 @@ use warnings;
 
 # Specifically for the constant that is the dir
 use Cpanel::iContact::Provider::Local ();
-use Cpanel::AdminBin::Serializer      ();
+use JSON::MaybeXS				      ();
 use File::Slurper                     ();
 
 =encoding utf-8
@@ -92,7 +92,8 @@ sub get_notice {
 	my ( $time, %opts ) = @_;
 	local $/;
 	my $file = $Cpanel::iContact::Provider::Local::DIR . "/$opts{'user'}/$time.json";
-    return Cpanel::AdminBin::Serializer::Load(File::Slurper::read_binary($file));
+    my $decoder = JSON::MaybeXS->new( utf8 => 1 );
+    return $decoder->decode(File::Slurper::read_binary($file));
 }
 
 =head2 get_all_notices