1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-06 16:46:30 +02:00

[formats] Use custom characterset in all formats

The specified characterset will now apply to all formats
thus allowing other charactersets than 'UTF-8'
This commit is contained in:
logmanoriginal
2016-11-07 20:49:44 +01:00
parent 4f4fb11789
commit 3a2cb9ea1e
5 changed files with 35 additions and 17 deletions

View File

@@ -48,12 +48,14 @@ class MrssFormat extends FormatAbstract {
EOD;
}
$charset = $this->getCharset();
/* Data are prepared, now let's begin the "MAGIE !!!" */
$toReturn = '<?xml version="1.0" encoding="UTF-8"?>';
$toReturn .= <<<EOD
<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:media="http://search.yahoo.com/mrss/"
$toReturn = <<<EOD
<?xml version="1.0" encoding="{$charset}"?>
<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:media="http://search.yahoo.com/mrss/"
xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{$title}</title>
@@ -69,13 +71,13 @@ EOD;
// Remove invalid non-UTF8 characters
ini_set('mbstring.substitute_character', 'none');
$toReturn = mb_convert_encoding($toReturn, 'UTF-8', 'UTF-8');
$toReturn = mb_convert_encoding($toReturn, $this->getCharset(), 'UTF-8');
return $toReturn;
}
public function display(){
$this
->setContentType('application/rss+xml; charset=UTF-8')
->setContentType('application/rss+xml; charset=' . $this->getCharset())
->callContentType();
return parent::display();