Author: hjtappe
New Revision: 31678
URL: http://www.egroupware.org/viewvc/egroupware?rev=31678&view=rev
Log:
Fix a problem with importing RSS feeds:
XML_Feed_Parser converts the input data to UTF-8.
If eGroupware already converts the input data to the system charset,
the XML encoding needs to be set correctly or the XML_Feed_Parser will
convert the data a second time, leading to bad display of e.g. German umlauts.
Modified:
trunk/news_admin/inc/class.news_admin_import.inc.php
Modified: trunk/news_admin/inc/class.news_admin_import.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/trunk/news_admin/inc/class.news_admin_import.inc.php?rev=31678&r1=31677&r2=31678&view=diff
— trunk/news_admin/inc/class.news_admin_import.inc.php (original)
+++ trunk/news_admin/inc/class.news_admin_import.inc.php Sun Aug 15 01:42:54 2010
@@ -24,7 +24,7 @@
* @var bonews
*/
var $bonews;
- /**
- Constructor
@@ -41,12 +41,12 @@
$this->bonews =& $bonews;
}
}
- /**
- Read the feed of the given URL
- @param string $url
-
- @return
-
-
@return
*/
function read($url)
{
@@ -54,10 +54,11 @@
if (!in_array($parts[‘scheme’],array(‘http’,‘https’,‘ftp’))) return false; // security!$feed_xml = file_get_contents($url,false);
-
-
// if the xml-file specifes an encoding, convert it to our own encoding if (preg_match('/\<\?xml.*encoding="([^"]+)"/i',$feed_xml,$matches) && $matches[1]) { -
$feed_xml = preg_replace('/(\<\?xml.*encoding=")([^"]+)"/i','$1'.$GLOBALS['egw']->translation->charset().'"',$feed_xml); $feed_xml = $GLOBALS['egw']->translation->convert($feed_xml,$matches[1]); } try {
@@ -67,7 +68,7 @@
}
return $parser;
}
- /**
- Import the feed of one category
@@ -78,11 +79,11 @@
function import($cat_id,$url)
{
$parser = $this->read($url);
-
if (!is_object($parser)) return false;
-
$imported = $newly = 0;
-
foreach ($parser as $entry)
-
foreach ($parser as $entry) { $check = array('cat_id' => $cat_id); if ($entry->content)
@@ -119,7 +120,7 @@
}
return array($imported,$newly);
}
- /**
- Import all categories, called via the async timed service
@@ -130,7 +131,7 @@
‘num_rows’ => 999,
‘start’ => 0,
),$cats,$nul,true)) return;
-
foreach($cats as $cat) { if ($cat['import_url'] && !((int)date('H') % $cat['import_frequency']))
This SF.net email is sponsored by
Make an app they can’t live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs