[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#583779: www.debian.org: fix broken charset for UTF-8 RSS feed



tags 583779 patch
thanks

Hi,

I plan to upload this fix this weekend (before the next DPN will be
published) if no one speaks against, or do it before.

Cheers

David



--- ../../../english/News/weekly/dwn-to-rdf-current.pl	2010-06-24 20:19:18.804734436 -0400
+++ ../../../english/News/weekly/dwn-to-rdf.pl	2010-06-24 22:10:37.948736820 -0400
@@ -24,6 +24,7 @@
 use warnings;
 
 use XML::RSS;
+use Encode qw(decode_utf8);
 
 if (!exists ($ENV{ENGLISHSRCDIR}) ||
     !exists ($ENV{CUR_DIR}) ||
@@ -120,8 +121,12 @@
 my $count = 0;
 my $headline = '';
 my $body = '';
+my $charset = charset;
+
 if (open (F, $current . '/index.wml')) {
     while (<F>) {
+	# prevent double utf-8 encode by XML::RSS 
+	$_ = decode_utf8($_) if ($charset eq 'utf-8') ;
 	if (/^<p><strong>(.*)<\/strong>(?:<br \/>)?\s*(.*)/) {
 	    $headline = $1;
 	    $body = $2."\n";

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: