]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Render.pm
* POSIX::strftime doesn't know about encodings and doesn't return a utf8
[ikiwiki.git] / IkiWiki / Render.pm
index 0dfa03cd4229f040ef17ae66579f1d3c4ca5ec35..d23dfdc2538716780cb80f94c05876562f9ea0e0 100644 (file)
@@ -29,13 +29,16 @@ sub htmlize ($$) { #{{{
                $blosxom::version="is a proper perl module too much to ask?";
                use warnings 'all';
                do "/usr/bin/markdown";
-               require Encode;
+               use 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)));
+               # 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");
@@ -232,13 +235,11 @@ sub check_overwrite ($$) { #{{{
 sub displaytime ($) { #{{{
        my $time=shift;
 
-       if ($config{timeformat} eq '%c') {
-               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 ($) { #{{{