From c3805557f183a9ad628b58a06e64269a4982f6d6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 27 Nov 2007 16:36:37 -0500 Subject: * Improve workaround for perl bug #376329. Rather than double-encoding, which has been reported to cause encoding problems (though I haven't reproduced them), just catch a failure of markdown, and retry. (The crazy perl bug magically disappears on the retry.) Closes: #449379 --- IkiWiki/Plugin/mdwn.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'IkiWiki') diff --git a/IkiWiki/Plugin/mdwn.pm b/IkiWiki/Plugin/mdwn.pm index ca8898679..254ab51d0 100644 --- a/IkiWiki/Plugin/mdwn.pm +++ b/IkiWiki/Plugin/mdwn.pm @@ -43,9 +43,11 @@ sub htmlize (@) { #{{{ # Workaround for perl bug (#376329) $content=Encode::encode_utf8($content); - $content=Encode::encode_utf8($content); - $content=&$markdown_sub($content); - $content=Encode::decode_utf8($content); + eval {$content=&$markdown_sub($content)}; + if ($@) { + eval {$content=&$markdown_sub($content)}; + print STDERR $@ if $@; + } $content=Encode::decode_utf8($content); return $content; -- cgit v1.2.3