diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-06-16 15:43:37 -0400 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-06-16 15:43:37 -0400 |
commit | bd7edfd9ca050edebbd6c09e24834934074909a8 (patch) | |
tree | 44b85669eb5ea941650b04970883f859243334f3 | |
parent | 00532174881f2171358df1ffe69b8ed1e31cd99c (diff) | |
download | ikiwiki-bd7edfd9ca050edebbd6c09e24834934074909a8.tar ikiwiki-bd7edfd9ca050edebbd6c09e24834934074909a8.tar.gz |
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.
-rw-r--r-- | IkiWiki/Plugin/textile.pm | 3 | ||||
-rw-r--r-- | debian/changelog | 4 | ||||
-rw-r--r-- | doc/bugs/textile_plugin_dies_if_input_has_a_non-utf8_character.mdwn | 2 |
3 files changed, 8 insertions, 1 deletions
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 <joeyh@debian.org> 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]] |