How to display ISO-8859-1 RSS correct
How to display ISO-8859-1 RSS correct
How can I display a ISO-8859-1 RSS correctly on my site? The norwegian characters come out garbled...
Re: How to display ISO-8859-1 RSS correct
I have tried manipulating both rss_parse.inc (UTF-8 ISO-8859-1 options) and .htaccess (iconv and mbstring values), but nothing helps... Any ideas anyone?
Re: How to display ISO-8859-1 RSS correct
Hmm, the default CMSms output is utf-8 (see config.php). If you define ISO-8859-1 for front- and backend it should work ...
Re: How to display ISO-8859-1 RSS correct
Yes, I know that would work - but I thought it was not recommended (slowdowns...)? I actually tried it once, and found that some of the menues in admin (eg. language selector) was displaying garbled norwegian characters - or maybe I missed a setting for that?
So, switching to ISO-8859-1 for my site is the only option?
So, switching to ISO-8859-1 for my site is the only option?
Re: How to display ISO-8859-1 RSS correct
With my smarty plugin pirss i have done it so:
[gelöscht durch Administrator]
Code: Select all
$url = isset($params['url']) ? $params['url'] : 'http://news.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml';
$encoding = isset($params['encoding']) ? $params['encoding'] : '';
$max_news = isset($params['maxnews']) ? $params['maxnews'] : 10;
$data = implode('', @file($url));
$outar=array();
$io=-1;
if ($data)
{
if ($encoding && function_exists('mb_convert_encoding')) {$data = mb_convert_encoding($data, $encoding, 'auto');}
[gelöscht durch Administrator]
Last edited by Piratos on Wed Sep 27, 2006 7:04 pm, edited 1 time in total.
Re: How to display ISO-8859-1 RSS correct
If you have problems with auto you can hardcoded:
iso-8859 from
utf-8 = tomb_convert_encoding($data, 'utf-8', 'iso-8859-1')
iso-8859 from
Re: How to display ISO-8859-1 RSS correct
Thank you so much, I got pirss to work! I just had to make two adjustments:
The only thing I noticed now is a dash presented as a square - is that a known issue?
Code: Select all
Line 5:
From
$encoding = isset($params['encoding']) ? $params['endcoding'] : '';
To
$encoding = isset($params['encoding']) ? $params['encoding'] : '';
Line 12:
From
if ($encoding && function_exists('mb_convert_encoding')) {$data = mb_convert_encoding($data, $encoding, 'auto');}
To
if ($encoding && function_exists('mb_convert_encoding')) {$data = mb_convert_encoding($data, $encoding, 'ISO-8859-1');}
Re: How to display ISO-8859-1 RSS correct
Code: Select all
endcoding
Re: How to display ISO-8859-1 RSS correct
Some feeds make chars hardcoded as example ô - i mean that mb_convert_encoding does not work with this.is that a known issue
But you can replace it before you are using .
Re: How to display ISO-8859-1 RSS correct
Is there a list of what should be replaced? And how do I make the replacement?
Re: How to display ISO-8859-1 RSS correct
Code yxou can see here http://en.selfhtml.org/html/referenz/ze ... _iso8859_1
In cases the unicode did not work you can change it with as example
$data=str_replace('unicode','html- name',$data);
look in the source of your html code and see what chars are bad and only take this , because it costs time to replace all.
In cases the unicode did not work you can change it with as example
$data=str_replace('unicode','html- name',$data);
look in the source of your html code and see what chars are bad and only take this , because it costs time to replace all.
Re: How to display ISO-8859-1 RSS correct
Thanks, I was able to replace the weird looking dash by copying the character from the original RSS feed i Opera, and then pasting it into the code in Textpad - displayed in Textpad as a kind of a box... I haven't been able to find any value for this character, but this method works...
Re: How to display ISO-8859-1 RSS correct
It is interesting to read the above, because I will also be using norwegian characters. I am making a site for our library and we have feeds on new books, films cd's etc. that we loan. Anyhow, I could not get this pirss installed. I tried uploading the folder to the modules folder, but it was not detected in the module installation in admin. So,... is there some other sort of way to install it? Where should the php file go?
Regards,
Vegard
Regards,
Vegard
Re: How to display ISO-8859-1 RSS correct
Pirss is a normal smarty plugin not a module.
Put it in the lib/smarty/plugins folder and the template in tmp/templates.
Put it in the lib/smarty/plugins folder and the template in tmp/templates.
Re: How to display ISO-8859-1 RSS correct
Thanks for explaining how to use the PIrss, it works. But I tried the above stuff but still get gibberish characters on the special norwegian letters. Therefore, could you give an example of how you would use this particular code?
$data=str_replace('unicode','html- name',$data);
Piratos wrote: Code yxou can see here http://en.selfhtml.org/html/referenz/ze ... _iso8859_1
In cases the unicode did not work you can change it with as example
$data=str_replace('unicode','html- name',$data);
look in the source of your html code and see what chars are bad and only take this , because it costs time to replace all.