From bd7edfd9ca050edebbd6c09e24834934074909a8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 16 Jun 2008 15:43:37 -0400 Subject: textile: The Text::Textile perl module has some regexps that fail if input is flagged as utf-8, but contains invalid characters such as 0x92. To prevent it from crashing, re-encode the content before calling it, which will ensure that it's really utf-8. --- IkiWiki/Plugin/textile.pm | 3 ++- debian/changelog | 4 ++++ doc/bugs/textile_plugin_dies_if_input_has_a_non-utf8_character.mdwn | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/IkiWiki/Plugin/textile.pm b/IkiWiki/Plugin/textile.pm index 5de71bf6e..208f295d2 100644 --- a/IkiWiki/Plugin/textile.pm +++ b/IkiWiki/Plugin/textile.pm @@ -7,6 +7,7 @@ package IkiWiki::Plugin::textile; use warnings; use strict; use IkiWiki 2.00; +use Encode; sub import { #{{{ hook(type => "htmlize", id => "txtl", call => \&htmlize); @@ -14,7 +15,7 @@ sub import { #{{{ sub htmlize (@) { #{{{ my %params=@_; - my $content = $params{content}; + my $content = decode_utf8(encode_utf8($params{content})); eval q{use Text::Textile}; return $content if $@; diff --git a/debian/changelog b/debian/changelog index e1a1d7b33..71c8e6f31 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,10 @@ ikiwiki (2.51) UNRELEASED; urgency=low * hnb: New plugin, contributed by Axel Beckert. * meta: Store "description" in pagestate for use by other plugins. * map: Support show=description. + * textile: The Text::Textile perl module has some regexps that fail if + input is flagged as utf-8, but contains invalid characters such as 0x92. + To prevent it from crashing, re-encode the content before calling it, + which will ensure that it's really utf-8. -- Joey Hess Sun, 15 Jun 2008 15:03:33 -0400 diff --git a/doc/bugs/textile_plugin_dies_if_input_has_a_non-utf8_character.mdwn b/doc/bugs/textile_plugin_dies_if_input_has_a_non-utf8_character.mdwn index d10cc3e5a..7ec1edc4e 100644 --- a/doc/bugs/textile_plugin_dies_if_input_has_a_non-utf8_character.mdwn +++ b/doc/bugs/textile_plugin_dies_if_input_has_a_non-utf8_character.mdwn @@ -10,3 +10,5 @@ The first two complaints happen if textile is not loaded, the third fatal one ha 0x92 is "single quote" in the evil windows default codepage. It would be nice to handle this gracefully and not abort ikiwiki at this point, or alternatively, die fatally but mention which input page caused the error. Interestingly enough, in my case, the input file has several other bad windows characters (0xFC, u-umlaut) which have not caused ikiwiki to abort. ikiwiki version 2.50. -- [[JonDowland]] + +> Fixed in git. [[done]] --[[Joey]] -- cgit v1.2.3