404/goto: Fix 404 display of utf-8 pages.
authorJoey Hess <joey@gnu.kitenet.net>
Mon, 14 Dec 2009 23:16:47 +0000 (18:16 -0500)
committerJoey Hess <joey@gnu.kitenet.net>
Mon, 14 Dec 2009 23:16:47 +0000 (18:16 -0500)
Problem here was that no charset http header was being sent.

I fixed this globally by making cgi_custom_failure send the header.
Required changing its parameters.

IkiWiki/CGI.pm
IkiWiki/Plugin/getsource.pm
IkiWiki/Plugin/goto.pm
debian/changelog

index 9277223f00e8e8d0f30071e7b47462db54cd5e55..866711a719478cd7bde8a0fb8ecdfc44e8678ef9 100644 (file)
@@ -235,11 +235,15 @@ sub cgi_prefs ($$) {
        showform($form, $buttons, $session, $q);
 }
 
-sub cgi_custom_failure ($$) {
-       my $header=shift;
+sub cgi_custom_failure ($$$) {
+       my $q=shift;
+       my $httpstatus=shift;
        my $message=shift;
 
-       print $header;
+       print $q->header(
+               -status => $httpstatus,
+               -charset => 'utf-8',
+       );
        print $message;
 
        # Internet Explod^Hrer won't show custom 404 responses
@@ -274,7 +278,7 @@ sub check_banned ($$) {
                $session->delete();
                cgi_savesession($session);
                cgi_custom_failure(
-                       $q->header(-status => "403 Forbidden"),
+                       $q, "403 Forbidden",
                        gettext("You are banned."));
        }
 }
index ae9ea3cc7af4ffe27b46d65528d380420ac5b368..d1555430e82d83bbe61064d04b335cdf48a85317 100644 (file)
@@ -58,7 +58,8 @@ sub cgi_getsource ($) {
 
        if (! exists $pagesources{$page}) {
                IkiWiki::cgi_custom_failure(
-                       $cgi->header(-status => "404 Not Found"),
+                       $cgi,
+                       "404 Not Found",
                        IkiWiki::misctemplate(gettext("missing page"),
                                "<p>".
                                sprintf(gettext("The page %s does not exist."),
index 2e2dc04a111a164745fb628785b509d40e024e6c..439552f62f9d5b3fe97c33d8397a559118e25b71 100644 (file)
@@ -51,7 +51,8 @@ sub cgi_goto ($;$) {
 
        if (! length $link) {
                IkiWiki::cgi_custom_failure(
-                       $q->header(-status => "404 Not Found"),
+                       $q,
+                       "404 Not Found",
                        IkiWiki::misctemplate(gettext("missing page"),
                                "<p>".
                                sprintf(gettext("The page %s does not exist."),
index d84477298e557f4e07f1b42d36428506bb24bea7..ff922532a31045a4e5333d9eab4281efafabe0c7 100644 (file)
@@ -10,6 +10,7 @@ ikiwiki (3.20091203) UNRELEASED; urgency=low
   * attachment: Fix several utf-8 problems.
   * attachment: Fix reversion in attachment sorting by age.
   * remove: Fix problem removing pages with utf-8 in the name.
+  * 404/goto: Fix 404 display of utf-8 pages.
 
  -- Joey Hess <joeyh@debian.org>  Wed, 02 Dec 2009 17:22:21 -0500