How to display ISO-8859-1 RSS correct

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
avegard
Forum Members
Forum Members
Posts: 12
Joined: Sun Oct 08, 2006 10:32 am

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

Post by avegard »

Well,... I didnt mange to work this out myself, so my cousin did this code for me

Code: Select all

		$bytt = array("Æ", "Ø", "Å", "æ", "ø", "å");
		$ny  = array("Æ", "Ø", "Å", "æ", "ø", "å");
			
		$data = str_replace($bytt, $ny, $data);   	

It worked on the link at least, which will be all that I use, so I am good for now.
User avatar
Nettie
Forum Members
Forum Members
Posts: 53
Joined: Tue Oct 03, 2006 11:42 pm

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

Post by Nettie »

Can anybody please tell me what exactly I have to do to get this Pirss working? I need to use the characters æ ø å. Should I install the pirss in the earlier mentioned folders and what do I have to edit in those files???

I am using the formbuilder module and the users of the site has to be able to insert the above letters. Should I change the utf-8 to ISO-8859-1 while I have installed pirss?

I am a bit confused and not so good in php yet - just started!!!

Hope anybody can help me out here, as it is really buggin me that I can't get it working. I would hate to have to change to a different system because of that little detail, as I really love CMS Made Simple a lot.

??? ??? ??? :o
avegard
Forum Members
Forum Members
Posts: 12
Joined: Sun Oct 08, 2006 10:32 am

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

Post by avegard »

Yes, you can change the function.pirss.php file.

Code: Select all

<?
function smarty_cms_function_pirss($params, &$smarty)
{
  $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, 'utf-8', 'ISO-8859-1');}
     //$data=str_replace('å','å',$data);


		if ($url == "http://www.esbenfjord.dk/bibfeed/norgefeed.xml" || $url == "http://www.url2.com" || $url == "http://www.url3.com"){

			$bytt = array("À", "Á", "Â", "Ã", "Ä", "Å", "Æ", "Ç", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ð", "Ñ", "Ò", "Ó", "Ô", "Õ", "Ö", "Ø", "Ù", "Ú", "Û", "Ü", "Ý", "Þ", "ß",
			"à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ");
			$ny  = array("À", "Á", "Â", "Ã", "Ä", "Å", "Æ", "Ç", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ð", "Ñ", "Ò", "Ó", "Ô", "Õ", "Ö", "Ø", "Ù", "Ú", "Û", "Ü", "Ý", "Þ", "ß",
			"à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ");

			$data = str_replace($bytt, $ny, $data);
		}
Insert this in the top of the file, also replacing the original 13 (?) lines. There is indeed a much more easy (and correct) method to get this done, but I don't remember it. This should work until then.
jannikbc

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

Post by jannikbc »

I had/have the same problem with æ/ø/å in menu's and espesially in FeedBackForms.... I have no idea what you are talking about, but tomorrow, when I'm sober again, I'll test all your codes - it seams like you have some notion of the problem, at least.

My deadline's the day after tomorrow. Argh! 69!
alby

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

Post by alby »

jannikbc wrote: I had/have the same problem with æ/ø/å in menu's and espesially in FeedBackForms...
Attention, FeedBackForms is deprecated (in favor of Formbuilder module)

Alby
Locked

Return to “CMSMS Core”