Package: libfrontier-rpc-perl
Severity: important
Version: 0.07b4-3

libfrontier-rpc-perl is not very compliant with unicode and utf8 .

I wrote in php a little client to interract with a daemon in perl .

I propose this patch , for encoding all unicode character in
numerical entities , it is for me the simple way to solve the problem . 


In attachement :
  - a little daemon in perl using libfrontier-rpc-perl
  - a little client in php for testing
  - a dump each http reponse made with tcpflow ( tcpflow  -ilo  src port 9000 )
  - a simple patch for /usr/share/perl5/Frontier/RPC2.pm

-- 
     ____________________________________________________________
    / Erwan MAS                                                 /\
   | mailto:[EMAIL PROTECTED]                                   |_/
___|________________________________________________________   |
\___________________________________________________________\__/
--- /usr/share/perl5/Frontier/RPC2.pm.orig      2002-08-03 02:48:06.000000000 
+0200
+++ /usr/share/perl5/Frontier/RPC2.pm   2006-10-15 16:19:39.418894676 +0200
@@ -234,6 +234,7 @@
        return ("<value><double>$value</double></value>");
     } else {
        $value =~ s/([&<>\"])/$char_entities{$1}/ge;
+       $value =~ s/([\x{80}-\x{FFFF}])/'&#' . ord($1) . ';'/gse;
        return ("<value><string>$value</string></value>");
     }
 }
#!/usr/bin/perl
#----------------------------------------------------------------------------------------------
use strict ;
#----------------------------------------------------------------------------------------------
use Frontier::Daemon ;
#----------------------------------------------------------------------------------------------
new Frontier::Daemon
    LocalPort => 9000 ,
    LocalAddr => '127.0.0.1' ,
    encoding  => 'UTF-8' ,
    methods => {
	'badstr' => \&ReturnBadString  
	};
#----------------------------------------------------------------------------------------------
sub ReturnBadString {
    my $n=shift ;
    my $m=shift ;
    #------------
    return sprintf("The 'copyright symbol' by %d is '%s' \nThe 'euro symbol' by %d is '%s'\n",
		    $n,chr(169)x$n,$m,chr(0x20ac)x$m) ;
    #------------
}
#----------------------------------------------------------------------------------------------
HTTP/1.1 200 OK
Date: Sun, 15 Oct 2006 14:27:24 GMT
Server: libwww-perl-daemon/1.36
Content-Length: 188
Content-Type: text/xml

<?xml version="1.0"?>
<methodResponse>
<params>
<param><value><string>The 'copyright symbol' by 0 is '' 
The 'euro symbol' by 0 is ''
</string></value></param>
</params>
</methodResponse>
HTTP/1.1 200 OK
Date: Sun, 15 Oct 2006 14:27:24 GMT
Server: libwww-perl-daemon/1.36
Content-Length: 209
Content-Type: text/xml

<?xml version="1.0"?>
<methodResponse>
<params>
<param><value><string>The 'copyright symbol' by 20 is '????????????????????' 
The 'euro symbol' by 0 is ''
</string></value></param>
</params>
</methodResponse>
HTTP/1.1 200 OK
Date: Sun, 15 Oct 2006 14:27:24 GMT
Server: libwww-perl-daemon/1.36
Content-Length: 209
Content-Type: text/xml

<?xml version="1.0"?>
<methodResponse>
<params>
<param><value><string>The 'copyright symbol' by 0 is '' 
The 'euro symbol' by 20 is 
'????????????????????????????????????????????????????????????'
</string></value></param>
</params>
</methodResponse>
HTTP/1.1 200 OK
Date: Sun, 15 Oct 2006 14:27:24 GMT
Server: libwww-perl-daemon/1.36
Content-Length: 230
Content-Type: text/xml

<?xml version="1.0"?>
<methodResponse>
<params>
<param><value><string>The 'copyright symbol' by 20 is 
'????????????????????????????????????????' 
The 'euro symbol' by 20 is 
'????????????????????????????????????????????????????????????'
</string></value></param>
</params>
</methodResponse>

Attachment: php-client.php
Description: application/httpd-php

Reply via email to