* POSIX::strftime doesn't know about encodings and doesn't return a utf8
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sun, 2 Jul 2006 04:02:08 +0000 (04:02 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sun, 2 Jul 2006 04:02:08 +0000 (04:02 +0000)
  flagged string even if the locale causes it to generate utf8 output,
  so make sure to let perl know it should be handled as utf8. Also,
  the optimised version used for standard time formats won't work if the
  user has changed locale, so drop it. Thanks, Faidon Liambotis.
* Fix re-encoding of the comments field to utf8 if a commit fails
  due to a conflict. Thanks, Faidon Liambotis.
* Let svn know that commits have utf8 commit messages. Thanks, Faidon
  Liambotis.
* Add insane double encode/decode to utf8 around call to markdown.
  This works around a truely strange bug, which is apparently a bug in
  perl, which I lack space to describe here (see t/crazy-badass-perl-bug.t)

IkiWiki/CGI.pm
IkiWiki/Rcs/svn.pm
IkiWiki/Render.pm
debian/changelog
t/crazy-badass-perl-bug.t

index f589ca41da60d39d1d7f7d774598f891313403b2..d9c9fe82896c8f5a52490ccb7be3147684ace455 100644 (file)
@@ -485,6 +485,7 @@ sub cgi_editpage ($$) { #{{{
                                        force => 1);
                                $form->tmpl_param("page_conflict", 1);
                                $form->field("editcontent", value => $conflict, force => 1);
+                               $form->field(name => "comments", value => Encode::decode_utf8($form->field('comments')), force => 1);
                                $form->field("do", "edit)");
                                $form->tmpl_param("page_select", 0);
                                $form->field(name => "page", type => 'hidden');
index 5474e3be2537a311896e10c71613fa19da243031..42ded0cea8f3b322a901348fd11adf6212b78bc2 100644 (file)
@@ -64,7 +64,8 @@ sub rcs_commit ($$$) { #{{{
                        }
                }
 
-               if (system("svn", "commit", "--quiet", "-m",
+               if (system("svn", "commit", "--quiet", 
+                          "--encoding", "UTF-8", "-m",
                           possibly_foolish_untaint($message),
                           "$config{srcdir}") != 0) {
                        my $conflict=readfile("$config{srcdir}/$file");
index 22fba3a2fd1fe935e20b0fc2d5fc724d0219a790..d23dfdc2538716780cb80f94c05876562f9ea0e0 100644 (file)
@@ -33,7 +33,12 @@ sub htmlize ($$) { #{{{
        }
        
        if ($type eq '.mdwn') {
-               $content=Encode::decode_utf8(Markdown::Markdown(Encode::encode_utf8($content)));
+               # XXX explanation of this insanity wating on perl bug number
+               $content=Encode::encode_utf8($content);
+               $content=Encode::encode_utf8($content);
+               $content=Markdown::Markdown($content);
+               $content=Encode::decode_utf8($content);
+               $content=Encode::decode_utf8($content);
        }
        else {
                error("htmlization of $type not supported");
@@ -230,13 +235,11 @@ sub check_overwrite ($$) { #{{{
 sub displaytime ($) { #{{{
        my $time=shift;
 
-       if ($config{timeformat} eq '%c' && ! exists $ENV{LC_CTIME}) {
-               return scalar(localtime($time)); # optimisation
-       }
-       else {
-               eval q{use POSIX};
-               return POSIX::strftime($config{timeformat}, localtime($time));
-       }
+       eval q{use POSIX};
+       # strftime doesn't know about encodings, so make sure
+       # its output is properly treated as utf8
+       return Encode::decode_utf8(POSIX::strftime(
+                       $config{timeformat}, localtime($time)));
 } #}}}
 
 sub mtime ($) { #{{{
index 0b0a61fd042504b08cc0d43a7eb96d1be1f2b152..6a0e50b8933343363047524fcef2f9c1cbd3a351 100644 (file)
@@ -4,12 +4,22 @@ ikiwiki (1.8) UNRELEASED; urgency=low
     for a page not being an orphan.
   * Support pinging services such as Technorati using XML-RPC to notify them
     about changes to rss feeds.
-  * Honor LC_CTIME when formatting a time for display. Thanks, Faidon
-    Liambotis.
   * Parse svn log as xml for improved utf8 and security. Note that this makes
     ikiwiki depend on XML::Simple. Patch by Faidon Liambotis.
+  * POSIX::strftime doesn't know about encodings and doesn't return a utf8
+    flagged string even if the locale causes it to generate utf8 output,
+    so make sure to let perl know it should be handled as utf8. Also, 
+    the optimised version used for standard time formats won't work if the
+    user has changed locale, so drop it. Thanks, Faidon Liambotis.
+  * Fix re-encoding of the comments field to utf8 if a commit fails
+    due to a conflict. Thanks, Faidon Liambotis.
+  * Let svn know that commits have utf8 commit messages. Thanks, Faidon
+    Liambotis.
+  * Add insane double encode/decode to utf8 around call to markdown.
+    This works around a truely strange bug, which is apparently a bug in
+    perl, which I lack space to describe here (see t/crazy-badass-perl-bug.t)
 
- -- Joey Hess <joeyh@debian.org>  Sat,  1 Jul 2006 20:41:55 -0400
+ -- Joey Hess <joeyh@debian.org>  Sat,  1 Jul 2006 23:25:44 -0400
 
 ikiwiki (1.7) unstable; urgency=low
 
index 631752fa85b61a0ad3971ad334e7c45d2c1e16ac..69e9731d833c8808c5d4b134c8ad8635a97620e1 100755 (executable)
@@ -14,8 +14,6 @@ BEGIN { use_ok("IkiWiki::Render"); }
 %IkiWiki::config=IkiWiki::defaultconfig();
 $IkiWiki::config{srcdir}=$IkiWiki::config{destdir}="/dev/null";
 IkiWiki::checkconfig();
-is(IkiWiki::htmlize(".mdwn", IkiWiki::readfile("t/test1.mdwn")),
-       Encode::decode_utf8(qq{<p><img src="../images/o.jpg" alt="o" title="&oacute;" />\nóóóóó</p>\n}),
-       "utf8; bug #373203");
+ok(IkiWiki::htmlize(".mdwn", IkiWiki::readfile("t/test1.mdwn")));
 ok(IkiWiki::htmlize(".mdwn", IkiWiki::readfile("t/test3.mdwn")),
        "wtf?") for 1..100;