* Stop testing Encode::is_utf8 in decode_form_utf8: That doesn't work.
* decode_form_utf8 only fixed the utf-8 encoding for fields that were registered at the time it was called, which was before the formbuilder_setup hook. Fields added by the hook didn't get decoded. But it can't be put after the hook either, since plugins using the hook need to be able to use form values. To fix this dilemma, it's been changed to a decode_cgi_utf8, which is called on the cgi query object, before the form is set up, and decodes *all* cgi parameters.master
parent
a22dfe6fef
commit
57bba4dac1
|
@ -71,14 +71,10 @@ sub check_canedit ($$$;$) { #{{{
|
|||
return $canedit;
|
||||
} #}}}
|
||||
|
||||
sub decode_form_utf8 ($) { #{{{
|
||||
my $form = shift;
|
||||
foreach my $f ($form->field) {
|
||||
next if Encode::is_utf8(scalar $form->field($f));
|
||||
$form->field(name => $f,
|
||||
value => decode_utf8($form->field($f)),
|
||||
force => 1,
|
||||
);
|
||||
sub decode_cgi_utf8 ($) { #{{{
|
||||
my $cgi = shift;
|
||||
foreach my $f ($cgi->param) {
|
||||
$cgi->param($f, map { decode_utf8 $_ } $cgi->param($f));
|
||||
}
|
||||
} #}}}
|
||||
|
||||
|
@ -150,6 +146,7 @@ sub cgi_signin ($$) { #{{{
|
|||
my $q=shift;
|
||||
my $session=shift;
|
||||
|
||||
decode_cgi_utf8($q);
|
||||
eval q{use CGI::FormBuilder};
|
||||
error($@) if $@;
|
||||
my $form = CGI::FormBuilder->new(
|
||||
|
@ -173,8 +170,6 @@ sub cgi_signin ($$) { #{{{
|
|||
$form->field(name => "do", type => "hidden", value => "signin",
|
||||
force => 1);
|
||||
|
||||
decode_form_utf8($form);
|
||||
|
||||
run_hooks(formbuilder_setup => sub {
|
||||
shift->(form => $form, cgi => $q, session => $session,
|
||||
buttons => $buttons);
|
||||
|
@ -212,6 +207,7 @@ sub cgi_prefs ($$) { #{{{
|
|||
|
||||
needsignin($q, $session);
|
||||
|
||||
decode_cgi_utf8($q);
|
||||
eval q{use CGI::FormBuilder};
|
||||
error($@) if $@;
|
||||
my $form = CGI::FormBuilder->new(
|
||||
|
@ -237,8 +233,6 @@ sub cgi_prefs ($$) { #{{{
|
|||
);
|
||||
my $buttons=["Save Preferences", "Logout", "Cancel"];
|
||||
|
||||
decode_form_utf8($form);
|
||||
|
||||
run_hooks(formbuilder_setup => sub {
|
||||
shift->(form => $form, cgi => $q, session => $session,
|
||||
buttons => $buttons);
|
||||
|
@ -303,6 +297,7 @@ sub cgi_editpage ($$) { #{{{
|
|||
my @fields=qw(do rcsinfo subpage from page type editcontent comments);
|
||||
my @buttons=("Save Page", "Preview", "Cancel");
|
||||
|
||||
decode_cgi_utf8($q);
|
||||
eval q{use CGI::FormBuilder};
|
||||
error($@) if $@;
|
||||
my $form = CGI::FormBuilder->new(
|
||||
|
@ -320,8 +315,6 @@ sub cgi_editpage ($$) { #{{{
|
|||
wikiname => $config{wikiname},
|
||||
);
|
||||
|
||||
decode_form_utf8($form);
|
||||
|
||||
run_hooks(formbuilder_setup => sub {
|
||||
shift->(form => $form, cgi => $q, session => $session,
|
||||
buttons => \@buttons);
|
||||
|
|
|
@ -3,6 +3,14 @@ ikiwiki (2.18) UNRELEASED; urgency=low
|
|||
* Split error messages for failures to drop real uid and gid.
|
||||
* Retry dropping uid and gid, possibly this will help with the "Resource
|
||||
temporarily unavailable" failures I've experienced under xen.
|
||||
* Stop testing Encode::is_utf8 in decode_form_utf8: That doesn't work.
|
||||
* decode_form_utf8 only fixed the utf-8 encoding for fields that were
|
||||
registered at the time it was called, which was before the
|
||||
formbuilder_setup hook. Fields added by the hook didn't get decoded.
|
||||
But it can't be put after the hook either, since plugins using the hook
|
||||
need to be able to use form values. To fix this dilemma, it's been changed
|
||||
to a decode_cgi_utf8, which is called on the cgi query object, before the
|
||||
form is set up, and decodes *all* cgi parameters.
|
||||
|
||||
-- Joey Hess <joeyh@debian.org> Tue, 01 Jan 2008 18:46:59 -0500
|
||||
|
||||
|
|
Loading…
Reference in New Issue