Alexander Litvinov wrote:
> But I have found one thing:
> $ export REQUEST_METHOD=GET
> $ export 
> QUERY_STRING='page=people%2F%D0%9A%D1%83%D0%B7%D0%BD%D0%B5%D1%86%D0%BE%D0%B2%D0%B0_%D0%9B%D1%8E%D0%B1%D0%BE%D0%B2%D1%8C_%D0%9D%D0%B8%D0%BA%D0%BE%D0%BB%D0%B0%D0%B5%D0%B2%D0%BD%D0%B0&do=goto'
> $ ~/public_html/cgi-bin/ikiwiki.cgi
> Status: 302 Found
> Location: /~lan/people/__/

Simpler, non-ikiwiki related test case:

perl -le 'use Encode; use URI; print 
URI->new("http://localhost/".decode_utf8(shift))' 'Кузнецова_Любовь_Николаевна'

The actual bug is in liburi-perl, and was fixed in version 1.38:

2008-04-03   Gisle Aas <gi...@activestate.com>

   Release 1.36

   <ger...@tty.nl>: Escape Unicode strings as UTF-8.

You can get a fixed version of the package from backports.

> How it works: URI->new tries to escape all chars at function _init at
> /usr/share/perl5/URI.pm:76. But it does not use any function for that,
> it use internal map which contains codes from 0..255 (see
> /usr/share/perl5/URI/Escape.pm:157). My fix simply convert russian chars
> into sequence of bytes in utf8 encoding and pass it to URI.

That fails with the fixed version of liburi-perl. With that version,
if I encode_utf8 a utf-8 string and pass it to URI, the result is doubly
encoded, and won't work:

j...@gnu:~>perl -le 'use Encode; use URI; print 
URI->new("http://localhost/".encode_utf8(shift))' 'Кузнецова_Любовь_Николаевна'
http://localhost/%C3%90%C2%9A%C3%91%C2%83%C3%90%C2%B7%C3%90%C2%BD%C3%90%C2%B5%C3%91%C2%86%C3%90%C2%BE%C3%90%C2%B2%C3%90%C2%B0_%C3%90%C2%9B%C3%91%C2%8E%C3%90%C2%B1%C3%90%C2%BE%C3%90%C2%B2%C3%91%C2%8C_%C3%90%C2%9D%C3%90%C2%B8%C3%90%C2%BA%C3%90%C2%BE%C3%90%C2%BB%C3%90%C2%B0%C3%90%C2%B5%C3%90%C2%B2%C3%90%C2%BD%C3%90%C2%B0

So, I can't make that change. I can, instead, make ikiwiki explicitly depend
on a non-broken version of liburi-perl.

-- 
see shy jo

Attachment: signature.asc
Description: Digital signature

Reply via email to