]> sipb.mit.edu Git - ikiwiki.git/commitdiff
* Patch from Recai Oktaş to improve utf-8 support, it should now use proper
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sun, 11 Jun 2006 18:51:49 +0000 (18:51 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sun, 11 Jun 2006 18:51:49 +0000 (18:51 +0000)
  utf-8 for edit and other fields, and for recentchanges. There may still
  be utf-8 issues with the preferences page though.

IkiWiki/CGI.pm
IkiWiki/Render.pm
debian/changelog

index cf6000314a15f3a07aa9a483f9b574b2da9b7bf2..986a8ee1d6b78a0c107d7732d787282ef1b40a7c 100644 (file)
@@ -43,7 +43,8 @@ sub cgi_recentchanges ($) { #{{{
                styleurl => styleurl(),
                baseurl => "$config{url}/",
        );
-       print $q->header, $template->output;
+       require Encode;
+       print $q->header(-charset=>'utf-8'), Encode::decode_utf8($template->output);
 } #}}}
 
 sub cgi_signin ($$) { #{{{
@@ -55,6 +56,7 @@ sub cgi_signin ($$) { #{{{
                title => "signin",
                fields => [qw(do title page subpage from name password confirm_password email)],
                header => 1,
+               charset => "utf-8",
                method => 'POST',
                validate => {
                        confirm_password => {
@@ -172,7 +174,7 @@ sub cgi_signin ($$) { #{{{
                                $form->field(name => "confirm_password", type => "hidden");
                                $form->field(name => "email", type => "hidden");
                                $form->text("Registration successful. Now you can Login.");
-                               print $session->header();
+                               print $session->header(-charset=>'utf-8');
                                print misctemplate($form->title, $form->render(submit => ["Login"]));
                        }
                        else {
@@ -202,12 +204,12 @@ sub cgi_signin ($$) { #{{{
                        
                        $form->text("Your password has been emailed to you.");
                        $form->field(name => "name", required => 0);
-                       print $session->header();
+                       print $session->header(-charset=>'utf-8');
                        print misctemplate($form->title, $form->render(submit => ["Login", "Register", "Mail Password"]));
                }
        }
        else {
-               print $session->header();
+               print $session->header(-charset=>'utf-8');
                print misctemplate($form->title, $form->render(submit => ["Login", "Register", "Mail Password"]));
        }
 } #}}}
@@ -222,6 +224,7 @@ sub cgi_prefs ($$) { #{{{
                fields => [qw(do name password confirm_password email 
                              subscriptions locked_pages)],
                header => 0,
+               charset => "utf-8",
                method => 'POST',
                validate => {
                        confirm_password => {
@@ -281,7 +284,7 @@ sub cgi_prefs ($$) { #{{{
                $form->text("Preferences saved.");
        }
        
-       print $session->header();
+       print $session->header(-charset=>'utf-8');
        print misctemplate($form->title, $form->render(submit => \@buttons));
 } #}}}
 
@@ -293,6 +296,7 @@ sub cgi_editpage ($$) { #{{{
        my $form = CGI::FormBuilder->new(
                fields => [qw(do rcsinfo subpage from page editcontent comments)],
                header => 1,
+               charset => "utf-8",
                method => 'POST',
                validate => {
                        editcontent => '/.+/',
@@ -414,7 +418,8 @@ sub cgi_editpage ($$) { #{{{
                            ! length $form->field('editcontent')) {
                                my $content="";
                                if (exists $pagesources{lc($page)}) {
-                                       $content=readfile(srcfile($pagesources{lc($page)}));
+                                       require Encode;
+                                       $content=Encode::decode_utf8(readfile(srcfile($pagesources{lc($page)})));
                                        $content=~s/\n/\r\n/g;
                                }
                                $form->field(name => "editcontent", value => $content,
@@ -445,7 +450,8 @@ sub cgi_editpage ($$) { #{{{
                }
                if (defined $form->field('comments') &&
                    length $form->field('comments')) {
-                       $message.=": ".$form->field('comments');
+                       require Encode;
+                       $message.=Encode::decode_utf8(": ".$form->field('comments'));
                }
                
                if ($config{rcs}) {
index 0dfa03cd4229f040ef17ae66579f1d3c4ca5ec35..87546eeb3c785259df656ef67f24030fd0e2e15a 100644 (file)
@@ -29,13 +29,10 @@ sub htmlize ($$) { #{{{
                $blosxom::version="is a proper perl module too much to ask?";
                use warnings 'all';
                do "/usr/bin/markdown";
-               require Encode;
        }
        
        if ($type eq '.mdwn') {
-               # Markdown does character based stuff that does not work
-               # well with utf-8 strings.
-               $content=Encode::decode_utf8(Markdown::Markdown(Encode::encode_utf8($content)));
+               $content=Markdown::Markdown($content);
        }
        else {
                error("htmlization of $type not supported");
index e552cac9d901fc60c62d4fc97f6f291fb1154640..5ba1786214c306451136567d737c7553d3ba3ee7 100644 (file)
@@ -28,8 +28,11 @@ ikiwiki (1.5) UNRELEASED; urgency=low
   * Doc updates for git.
   * Fix absolute url munging in rss generation to support https, ftp, etc urls
     not just http urls.
+  * Patch from Recai Oktaş to improve utf-8 support, it should now use proper
+    utf-8 for edit and other fields, and for recentchanges. There may still
+    be utf-8 issues with the preferences page though.
 
- -- Joey Hess <joeyh@debian.org>  Thu,  8 Jun 2006 02:05:57 -0400
+ -- Joey Hess <joeyh@debian.org>  Sun, 11 Jun 2006 14:48:41 -0400
 
 ikiwiki (1.4) unstable; urgency=low