When calling decode_utf8 on known-problimatic content in aggregate, explicitly pass...
authorJoey Hess <joey@kodama.kitenet.net>
Wed, 28 May 2008 19:38:04 +0000 (15:38 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Wed, 28 May 2008 19:38:04 +0000 (15:38 -0400)
IkiWiki/Plugin/aggregate.pm
debian/changelog

index a9c7447fa8faf6a082e714b84cd203f2c4e3355d..e44c26f747b66397fd52838be45ad1853641ab46 100644 (file)
@@ -407,14 +407,14 @@ sub aggregate (@) { #{{{
                        # that contains invalid UTF-8 sequences. Convert
                        # feed to ascii to try to work around.
                        $feed->{message}.=" ".sprintf(gettext("(invalid UTF-8 stripped from feed)"));
-                       $content=Encode::decode_utf8($content);
+                       $content=Encode::decode_utf8($content, 0);
                        $f=eval{XML::Feed->parse(\$content)};
                }
                if ($@) {
                        # Another possibility is badly escaped entities.
                        $feed->{message}.=" ".sprintf(gettext("(feed entities escaped)"));
                        $content=~s/\&(?!amp)(\w+);/&amp;$1;/g;
-                       $content=Encode::decode_utf8($content);
+                       $content=Encode::decode_utf8($content, 0);
                        $f=eval{XML::Feed->parse(\$content)};
                }
                if ($@) {
index 4b66aa697023e3213cdd1eb5891579f4ac7b4dcd..1d9f18320fe52e520070bcd9028e84ea214cd4e0 100644 (file)
@@ -2,6 +2,10 @@ ikiwiki (2.48) UNRELEASED; urgency=low
 
   * Add rel=nofollow to edit links. This may prevent some spiders from
     pounding on the cgi following edit links.
+  * When calling decode_utf8 on known-problimatic content in aggregate,
+    explicitly pass 0 (FB_DEFAULT) as the second parameter. Apparently perl
+    5.8 needs this to avoid crashing on malformed utf-8, despite its docs
+    saying it is the default.
 
  -- Joey Hess <joeyh@debian.org>  Wed, 28 May 2008 03:07:37 -0400