From 59d929d6b1271c84c6d17ffbff65b57bf67d49e6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 9 Jan 2010 16:20:09 -0500 Subject: [PATCH] websetup: Fix utf-8 problems. --- IkiWiki/Plugin/websetup.pm | 9 +++++++-- debian/changelog | 1 + doc/bugs/utf-8_bug_in_websetup.pm.mdwn | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/IkiWiki/Plugin/websetup.pm b/IkiWiki/Plugin/websetup.pm index 9edd22d26..75aa3681c 100644 --- a/IkiWiki/Plugin/websetup.pm +++ b/IkiWiki/Plugin/websetup.pm @@ -139,7 +139,11 @@ sub showfields ($$$@) { my $value=$config{$key}; if ($info{safe} && (ref $value eq 'ARRAY' || ref $info{example} eq 'ARRAY')) { - $value=[(ref $value eq 'ARRAY' ? @{$value} : ""), "", ""]; # blank items for expansion + $value=[(ref $value eq 'ARRAY' ? map { Encode::encode_utf8($_) } @{$value} : ""), + "", ""]; # blank items for expansion + } + else { + $value=Encode::encode_utf8($value); } if ($info{type} eq "string") { @@ -290,7 +294,6 @@ sub showform ($$) { shift->(form => $form, cgi => $cgi, session => $session, buttons => $buttons); }); - IkiWiki::decode_form_utf8($form); my %fields=showfields($form, undef, undef, IkiWiki::getsetup()); @@ -308,6 +311,8 @@ sub showform ($$) { $fields{$_}=$shown{$_} foreach keys %shown; } } + + IkiWiki::decode_form_utf8($form); if ($form->submitted eq "Cancel") { IkiWiki::redirect($cgi, $config{url}); diff --git a/debian/changelog b/debian/changelog index 4f7c1a60c..5d5cdd564 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,7 @@ ikiwiki (3.20100104) UNRELEASED; urgency=low are disabled. * comments: Fix permalinks for comments using new conflict-free filenames. * img: Support alignment of images with captions. (Giuseppe Bilotta) + * websetup: Fix utf-8 problems. -- Joey Hess Mon, 04 Jan 2010 12:53:24 -0500 diff --git a/doc/bugs/utf-8_bug_in_websetup.pm.mdwn b/doc/bugs/utf-8_bug_in_websetup.pm.mdwn index c3a5262cd..debedb01c 100644 --- a/doc/bugs/utf-8_bug_in_websetup.pm.mdwn +++ b/doc/bugs/utf-8_bug_in_websetup.pm.mdwn @@ -4,6 +4,8 @@ I type chinese characters into the fields. After press "save setup" button the c I submit a patch that solve the problem for me. --Lingo +> Fully fixing it is slightly more complex, but now [[done]] --[[Joey]] + ---- --- websetup.pm 2009-12-02 05:07:46.000000000 +0800 -- 2.39.5