diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 586d7d4e9..6b963ba10 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,4 +1,5 @@ 7.6.0 + - fixed: Syndicated Content doesn't decode alternate character sets - fixed: Some templates ship with isPublic=1 - fixed: DataForm export tab delimited doesn't work - fixed: Project Manager sometimes causes errors when adding users to a task diff --git a/lib/WebGUI/Asset/Wobject/SyndicatedContent.pm b/lib/WebGUI/Asset/Wobject/SyndicatedContent.pm index 6086bd6ee..92ff5e97e 100644 --- a/lib/WebGUI/Asset/Wobject/SyndicatedContent.pm +++ b/lib/WebGUI/Asset/Wobject/SyndicatedContent.pm @@ -345,7 +345,12 @@ sub _get_rss_data { $cache->set({'error' => 1, 'error_status' => $response->status_line}, 3600); return undef; } - my $xml = $response->decoded_content; + my $xmlEncoding; + if ($response->content =~ /<\?xml.*?encoding=['"](\S+)['"]/i) { + $xmlEncoding = $1; + } + + my $xml = $response->decoded_content($xmlEncoding ? (charset => $xmlEncoding) : ()); # Approximate with current time if we don't have a Last-Modified # header coming from the RSS source. @@ -353,16 +358,7 @@ sub _get_rss_data { my $last_modified = defined($http_lm)? $http_lm : time; # XML::RSSLite does not handle so: - $xml =~ s//$1/sg; - - # Convert encoding if needed - $xml =~ /<\?xml.*?encoding=['"](\S+)['"]/i; - my $xmlEncoding = $1 || 'utf8'; - - if (Encode::is_utf8($xml)) { - } else { - $xml = Encode::decode($xmlEncoding, $xml); - } + $xml =~ s//HTML::Entities::encode_entities($1)/esg; my $rss_lite = {}; eval {