]> sipb.mit.edu Git - ikiwiki.git/commitdiff
textile: The Text::Textile perl module has some regexps that fail if input is flagged...
authorJoey Hess <joey@kodama.kitenet.net>
Mon, 16 Jun 2008 19:43:37 +0000 (15:43 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Mon, 16 Jun 2008 19:43:37 +0000 (15:43 -0400)
IkiWiki/Plugin/textile.pm
debian/changelog
doc/bugs/textile_plugin_dies_if_input_has_a_non-utf8_character.mdwn

index 5de71bf6eb11aa682dde75eaac98970b4174c9f9..208f295d2b16aeb37c4434253c46d48d66057222 100644 (file)
@@ -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 $@;
index e1a1d7b334f9a150e7921bee3f606c7834142d15..71c8e6f3150d275b881fae744eed6c7186b5ce92 100644 (file)
@@ -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
 
index d10cc3e5a7a8d4fd1fdc33d003216a496b4e6c2f..7ec1edc4e6638611fd3d64f5e3ff32511194eeac 100644 (file)
@@ -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]]