Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Cross browser parse issue....

Cross browser parse issue....
Thread Tools
Mac Elite
Join Date: Mar 2002
Location: Clogland
Status: Offline
Reply With Quote
Aug 11, 2005, 08:57 AM
 
.... getting a lot of special characters from an rss feed, which after dicking around for far too long looking for a solution have decided to weed them out "manually", in this manner.....

Code:
function display(){ $this->description = str_replace ( '&amp;', '&', $this->description ); $this->description = str_replace ( 'ë', 'ë', $this->description ); $this->description = str_replace ( '&euml;', 'ë', $this->description ); $this->description = str_replace ( '&rsquo;', '\'', $this->description ); $this->description = str_replace ( '&lsquo;', '\'', $this->description ); $this->description = str_replace ( '[image1_left]', '', $this->description ); $this->description = str_replace ( 'Â’', '\'', $this->description ); $this->description = str_replace ( '‘', '\'', $this->description ); $this->description = str_replace ( '&euro;', '€', $this->description ); $this->description = str_replace ( '&iuml;', 'ï', $this->description ); $this->description = str_replace ( '&eacute;', 'é', $this->description ); //$this->description = str_replace ( 'i?n', 'ë', $this->description ); //$this->title = str_replace ( 'i?n', 'ë', $this->title ); $this->title = str_replace ( '&eacute;', 'é', $this->title ); $this->title = str_replace ( '&amp;', '&', $this->title ); $this->title = str_replace ( '&euml;', 'ë', $this->title ); $this->title = str_replace ( 'ë', 'ë', $this->title ); $this->title = str_replace ( 'Â’', '\'', $this->title ); $this->title = str_replace ( '‘', '\'', $this->title ); $this->title = str_replace ( '&lsquo;', '\'', $this->title ); $this->title = str_replace ( '&rsquo;', '\'', $this->title ); $this->title = str_replace ( '[image1_left]', '', $this->title ); $this->title = str_replace ( '&euro;', '€', $this->title ); $this->title = str_replace ( '&iuml;', 'ï', $this->title ); $this->pubDate = substr_replace ( $this->pubDate, '',0,4); $this->pubDate = substr_replace ( $this->pubDate, '',12,18); printf('<a href="main.php?a=2">%s</a><br />', htmlspecialchars($this->title)); } }
.....all working hunky dory in Win IE6, but Firefox is getting sometimes getting an " i?n " as opposed to an " ë ".

I tried str_replace on it, but it wasn't having it (the code editted out above).

What to do? What to do? What to do?
     
Dedicated MacNNer
Join Date: Nov 2001
Location: Are Eye
Status: Offline
Reply With Quote
Aug 11, 2005, 09:39 AM
 
     
skalie  (op)
Mac Elite
Join Date: Mar 2002
Location: Clogland
Status: Offline
Reply With Quote
Aug 11, 2005, 09:52 AM
 
Originally Posted by registered_user

Indeed, it was perusing the numerous comments on that page that led me on the path of "weeding them out manually".

     
skalie  (op)
Mac Elite
Join Date: Mar 2002
Location: Clogland
Status: Offline
Reply With Quote
Aug 11, 2005, 09:54 AM
 
Seems like it's a header issue, throwing......

Code:
header('Content-type: text/html; charset=ISO-8859-15');
..... in to the code seems to have quietened things down a little.
(Last edited by skalie; Aug 11, 2005 at 12:55 PM. )
     
skalie  (op)
Mac Elite
Join Date: Mar 2002
Location: Clogland
Status: Offline
Reply With Quote
Aug 14, 2005, 01:12 AM
 
Originally Posted by registered_user
Three days later I finally got there....

The above code has been whittled down to...

Code:
function display(){ printf('<a href="main.php?a=2">%s</a><br />', html_entity_decode($this->description,ENT_QUOTES,'ISO8859-15')); }
with this as the header

Code:
header('Content-type: text/html; charset=UTF-8');
Hope that saves someone a week of hair-pulling one day.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:25 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2