Igor Gariev (gariev) wrote in changelog,
Igor Gariev
gariev
changelog

[livejournal] r16160: LJSUP-5462: XMLRPC calls with Unicode st...

Committer: gariev
LJSUP-5462: XMLRPC calls with Unicode strings result in 'Wide character in subroutine entry'
U   trunk/cgi-bin/Apache/LiveJournal.pm
Modified: trunk/cgi-bin/Apache/LiveJournal.pm
===================================================================
--- trunk/cgi-bin/Apache/LiveJournal.pm	2010-01-28 09:47:30 UTC (rev 16159)
+++ trunk/cgi-bin/Apache/LiveJournal.pm	2010-01-28 09:51:03 UTC (rev 16160)
@@ -1764,6 +1764,7 @@
 }
 
 package LJ::Protocol;
+use Encode();
 
 sub xmlrpc_method {
     my $method = shift;
@@ -1788,10 +1789,9 @@
     }
     my $error = 0;
     if (ref $req eq "HASH") {
-        foreach my $key ('subject', 'event') {
-            # get rid of the UTF8 flag in scalars
-            $req->{$key} = pack('C*', unpack('C*', $req->{$key}))
-                if $req->{$key};
+        # get rid of the UTF8 flag in scalars
+        while (my ($k, $v) = each %$req) {
+            $req->{$k} = Encode::encode_utf8($v) if Encode::is_utf8($v);
         }
         $req->{'props'}->{'interface'} = "xml-rpc";
     }

Tags: gariev, livejournal, pm
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments