From 83429adf04b7a4e2f2a01de9c276d3160173fb8b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 26 Sep 2008 15:40:01 -0400 Subject: [PATCH] decode utf-8 in recentchanges_link parameter --- IkiWiki/Plugin/recentchanges.pm | 3 ++- doc/bugs/unicode_encoded_urls_and_recentchanges.mdwn | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm index 37e45a05a..563ab7db1 100644 --- a/IkiWiki/Plugin/recentchanges.pm +++ b/IkiWiki/Plugin/recentchanges.pm @@ -4,6 +4,7 @@ package IkiWiki::Plugin::recentchanges; use warnings; use strict; use IkiWiki 2.00; +use Encode; sub import { #{{{ hook(type => "getsetup", id => "recentchanges", call => \&getsetup); @@ -86,7 +87,7 @@ sub cgi ($) { #{{{ # page they link to is deleted, or newly created, or # changes for whatever reason. So this CGI handles that # dynamic linking stuff. - my $page=$cgi->param("page"); + my $page=decode_utf8($cgi->param("page")); if (!defined $page) { error("missing page parameter"); } diff --git a/doc/bugs/unicode_encoded_urls_and_recentchanges.mdwn b/doc/bugs/unicode_encoded_urls_and_recentchanges.mdwn index 704ee18cf..d8696cb4c 100644 --- a/doc/bugs/unicode_encoded_urls_and_recentchanges.mdwn +++ b/doc/bugs/unicode_encoded_urls_and_recentchanges.mdwn @@ -17,9 +17,19 @@ the problem can be shown with an auto-setup'd ikiwiki without cgi when manually >> same happens, by the way, when using meta-redir to a page with high bytes in >> the name.) >> +>>> The problem is that all cgi inputs have to be explicitly decoded to +>>> utf-8, which I've now done for `recentchange_link`. +>>> +>>> I cannot, however, reproduce a problem with meta redir. Here it +>>> generated the following html, which redirected the browser ok: +>>> +>> >> update: i've had a look at the git options; you could run git with '-z' (NUL >> termination) in the `git_commit_info` function; this would require some >> changes in `parse_diff_tree`, but otherwise completely eliminate the >> problems with git escaping. >> +>>> If you would like to develop a patch to that effect, I'd be glad to +>>> drop the current nasty code. +>> >> --[[chrysn]] -- 2.26.2