httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nikolay Ananiev" <anan...@thegdb.com>
Subject Problem with APR::Request::encode and UTF8 data
Date Sat, 17 Sep 2005 19:00:56 GMT
APR::Request::encode has a problem escaping binary data (or utf8)
This utf8 string: "\x{5c0f}\x{98fc} \x{5f3e}.txt" after encoding
should become '%E5%B0%8F%E9%A3%BC%20%E5%BC%BE.txt'
but it doesn't. It becomes '%B0Ǯ+Ȯ.txt'
The following script demonstrates the problem and compares the results to
CGI.pm

#!/usr/bin/perl -w

use APR::Request;
use CGI::Util;

my $cgi_str = my $apr_str = "\x{5c0f}\x{98fc} \x{5f3e}.txt";
my $expected = '%E5%B0%8F%E9%A3%BC%20%E5%BC%BE.txt';

# strip utf8 flag. CGI.pm strips the utf8 flag
# internally, so don't strip it here
utf8::encode($apr_str);

$apr_str = APR::Request::encode($apr_str);
$cgi_str = CGI::Util::escape($cgi_str);

print "APR::Request\n";
print "STRING: $apr_str\n";
print "EXPECTED: $expected\n";

print "\nCGI.pm\n";
print "STRING: $cgi_str\n";
print "EXPECTED: $expected\n";




Mime
View raw message