aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>2009-02-03 19:48:55 +0000
committerSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>2009-02-03 19:48:55 +0000
commitdd862b4639bd470cbc3e726798af2f07587cb62e (patch)
treea7dea8869762181186fe5da68b907d473d414139
parent1b3dbe0b91d7646096229fb531a3527df3b3587a (diff)
downloadikiwiki-dd862b4639bd470cbc3e726798af2f07587cb62e.tar
ikiwiki-dd862b4639bd470cbc3e726798af2f07587cb62e.tar.gz
Work around XML::Atom strangeness that results in double-encoded posts
See [[bugs/Aggregated_Atom_feeds_are_double-encoded]]. By default, XML::Atom outputs strings of UTF-8 bytes with the Perl UTF8 flag stripped off, which IkiWiki assumes to be Latin-1 and re-encodes as UTF-8 on output. XML::Feed does not currently (0.41-1) set the magic variable to change this behaviour (I've filed a bug on CPAN), but IkiWiki can usefully set the same variable as a workaround.
-rw-r--r--IkiWiki/Plugin/aggregate.pm5
1 files changed, 5 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm
index c667ee2a9..e1baae666 100644
--- a/IkiWiki/Plugin/aggregate.pm
+++ b/IkiWiki/Plugin/aggregate.pm
@@ -534,6 +534,11 @@ sub aggregate (@) {
}
foreach my $entry ($f->entries) {
+ # XML::Feed doesn't work around XML::Atom's bizarre
+ # API, so we will. Real unicode strings? Yes please.
+ # See [[bugs/Aggregated_Atom_feeds_are_double-encoded]]
+ local $XML::Atom::ForceUnicode = 1;
+
my $c=$entry->content;
# atom feeds may have no content, only a summary
if (! defined $c && ref $entry->summary) {