Created
August 24, 2010 20:07
-
-
Save perlDreamer/548216 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt | |
index e212edb..15ba96c 100644 | |
--- a/docs/changelog/7.x.x.txt | |
+++ b/docs/changelog/7.x.x.txt | |
@@ -10,6 +10,7 @@ | |
- fixed #11798: Gallery request non existent image | |
- fixed #11800: Group to view for new events defaults to 'Everyone' | |
- fixed #11796: Gallery Drag & Drop broken in IE 7 | |
+ - fixed #11795: Wrong display UTF8 chars in Syndicated content | |
7.9.12 | |
- webgui.org homepage gives 404 (#11778) | |
diff --git a/lib/WebGUI/Asset/Wobject/SyndicatedContent.pm b/lib/WebGUI/Asset/Wobject/SyndicatedContent.pm | |
index 493c0db..e043c2e 100644 | |
--- a/lib/WebGUI/Asset/Wobject/SyndicatedContent.pm | |
+++ b/lib/WebGUI/Asset/Wobject/SyndicatedContent.pm | |
@@ -21,7 +21,7 @@ use Class::C3; | |
use base qw(WebGUI::AssetAspect::RssFeed WebGUI::Asset::Wobject); | |
use WebGUI::Macro; | |
use XML::FeedPP; | |
- | |
+use Encode; | |
=head1 NAME | |
@@ -170,7 +170,8 @@ sub generateFeed { | |
# if the content can be downgraded, it is either valid latin1 or didn't have | |
# an HTTP Content-Encoding header. In the second case, XML::FeedPP will take | |
# care of any encoding specified in the XML prolog | |
- utf8::downgrade($value, 1); | |
+ #utf8::downgrade($value, 1); | |
+ #$value = decode_utf8($value); | |
eval { | |
my $singleFeed = XML::FeedPP->new($value, utf8_flag => 1, -type => 'string', @opt); | |
$feed->merge_channel($singleFeed); | |
diff --git a/t/Asset/Wobject/SyndicatedContent.t b/t/Asset/Wobject/SyndicatedContent.t | |
index 397d3f1..1263dc9 100644 | |
--- a/t/Asset/Wobject/SyndicatedContent.t | |
+++ b/t/Asset/Wobject/SyndicatedContent.t | |
@@ -12,6 +12,7 @@ use FindBin; | |
use strict; | |
use File::Spec; | |
use lib "$FindBin::Bin/../../lib"; | |
+use Encode; | |
use Data::Dumper; | |
@@ -192,10 +193,11 @@ Rich Text editor in the first sentence of the description.", | |
#################################################################### | |
sub withCachedFeed { | |
- my ($url, $path, $block) = @_; | |
+ my ($url, $path, $block, $utf8) = @_; | |
$syndicated_content->update({ rssUrl => $url }); | |
- open my $file, '<', WebGUI::Test->getTestCollateralPath($path) | |
+ my $file_mode = $utf8 ? '<:encoding(utf8)' : '<'; | |
+ open my $file, $file_mode, WebGUI::Test->getTestCollateralPath($path) | |
or die "Unable to get RSS file: $path"; | |
my $content = do { local $/; <$file> }; | |
close $file; | |
@@ -247,6 +249,34 @@ withCachedFeed 'http://www.oncp.gob.ve/oncp.xml', 'oncp.xml', sub { | |
#################################################################### | |
# | |
+# Encoded feeds | |
+# | |
+#################################################################### | |
+ | |
+##Feed with no links or pubDates. | |
+$syndicated_content->update({ | |
+ hasTerms => '', | |
+ maxHeadlines => 50, | |
+}); | |
+ | |
+withCachedFeed 'http://psv.netwerk.to/nieuws/rss.xml', 'psv.xml', sub { | |
+ my $encoded_feed = $syndicated_content->generateFeed(); | |
+ | |
+ my $encoded_item = $encoded_feed->get_item(0); | |
+ diag $encoded_item->title; | |
+ is $encoded_item->title, "Siberi\x{00EB}", 'Checking UTF-8 file without a content encoding, but with utf8 in the XML prelude'; | |
+}, | |
+'utf8'; | |
+ | |
+withCachedFeed 'http://www.oncp.gob.ve/oncp.xml', 'oncp.xml', sub { | |
+ my $encoded_feed = $syndicated_content->generateFeed(); | |
+ | |
+ is $encoded_feed->title, "Oficina Nacional de Cr\x{00E9}dito P\x{00FA}blico", 'ISO 8859'; | |
+ diag $encoded_feed->title; | |
+}; | |
+ | |
+#################################################################### | |
+# | |
# sorting | |
# | |
#################################################################### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment