Page 1 of 2

How to display ISO-8859-1 RSS correct

Posted: Mon Sep 25, 2006 1:03 pm
by mgrendal
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

Posted: Wed Sep 27, 2006 1:30 pm
by mgrendal
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

Posted: Wed Sep 27, 2006 2:10 pm
by cyberman
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

Posted: Wed Sep 27, 2006 4:31 pm
by mgrendal
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?

Re: How to display ISO-8859-1 RSS correct

Posted: Wed Sep 27, 2006 6:28 pm
by Piratos
With my smarty plugin pirss i have done it so:

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]

Re: How to display ISO-8859-1 RSS correct

Posted: Wed Sep 27, 2006 7:06 pm
by Piratos
If you have problems with auto you can hardcoded:
mb_convert_encoding($data, 'utf-8', 'iso-8859-1')
utf-8  = to 

iso-8859  from

Re: How to display ISO-8859-1 RSS correct

Posted: Wed Sep 27, 2006 8:47 pm
by mgrendal
Thank you so much, I got pirss to work! I just had to make two adjustments:

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');}
The only thing I noticed now is a dash presented as a square - is that a known issue?

Re: How to display ISO-8859-1 RSS correct

Posted: Thu Sep 28, 2006 3:24 pm
by Piratos

Code: Select all

endcoding
This was a known issue but pirss is out of support.

Re: How to display ISO-8859-1 RSS correct

Posted: Thu Sep 28, 2006 3:27 pm
by Piratos
is that a known issue
Some feeds make chars hardcoded as example  &#244  - i mean that mb_convert_encoding does not work with this.

But you can replace it before you are using .

Re: How to display ISO-8859-1 RSS correct

Posted: Fri Sep 29, 2006 7:43 pm
by mgrendal
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

Posted: Sat Sep 30, 2006 8:56 am
by Piratos
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.

Re: How to display ISO-8859-1 RSS correct

Posted: Mon Oct 02, 2006 8:12 am
by mgrendal
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

Posted: Sun Oct 08, 2006 10:47 am
by avegard
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

Re: How to display ISO-8859-1 RSS correct

Posted: Sun Oct 08, 2006 11:40 am
by Piratos
Pirss is a normal smarty plugin not a module.

Put it in the lib/smarty/plugins folder and the template in tmp/templates.

Re: How to display ISO-8859-1 RSS correct

Posted: Tue Oct 17, 2006 9:07 pm
by avegard
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.