Subject: | Wrong return value of description() with xhtml content in atom feeds |
Hi,
it seems that are some locale specific bytes in a regex to filter out the
content of a xhtml element in atom feeds. Without a lot of research i
suppose there's a JIS fullwidth backslash. After replacing them with
ascii backslashes, description() works, but returns a xml data structure
as hash reference. I fixed this with generating a new XML::TreePP and
write() it, but i'm no sure if this is really the most elegant solution.
Is there any reason to return the hash reference? Returning a string
seems to be the expected result.
Best wishes, Mario
Subject: | hack_for_atom_content_xhtml.diff |
diff --git a/lib/XML/FeedPP.pm b/lib/XML/FeedPP.pm
index 0bca101..68c5396 100644
--- a/lib/XML/FeedPP.pm
+++ b/lib/XML/FeedPP.pm
@@ -2236,8 +2236,10 @@ sub get_value {
if ( UNIVERSAL::isa( $value, 'HASH' )
&& exists $value->{'-type'}
&& ($value->{'-type'} eq "xhtml")) {
- my $child = [ grep { /^[^_-_#]/ } keys %$value ];
+ my $child = [ grep { /^[^\#\-]/ } keys %$value ];
if (scalar @$child == 1) {
+ my $tpp = XML::TreePP->new( xml_decl => '' );
+ return $tpp->write( get_value( $value, $child->[0] ) );
return &get_value( $value, $child->[0] );
}
}