summaryrefslogtreecommitdiff
path: root/IkiWiki/Render.pm
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-07-02 04:02:08 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-07-02 04:02:08 +0000
commitac7b1c32b1356dab71fd13d303d58d4bdb212941 (patch)
tree2d6c47c345d046ac1c35d57820ad42a69f3ba1a1 /IkiWiki/Render.pm
parenta5fdf4714732c754c6bee16ff65fa85968737010 (diff)
* 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)
Diffstat (limited to 'IkiWiki/Render.pm')
-rw-r--r--IkiWiki/Render.pm19
1 files changed, 11 insertions, 8 deletions
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index 22fba3a2f..d23dfdc25 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -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 ($) { #{{{