 |
 |
Cross browser parse issue....
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2002
Location: Clogland
Status:
Offline
|
|
.... 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 ( '&', '&', $this->description );
$this->description = str_replace ( 'ë', 'ë', $this->description );
$this->description = str_replace ( 'ë', 'ë', $this->description );
$this->description = str_replace ( '’', '\'', $this->description );
$this->description = str_replace ( '‘', '\'', $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 ( '€', '€', $this->description );
$this->description = str_replace ( 'ï', 'ï', $this->description );
$this->description = str_replace ( 'é', 'é', $this->description );
//$this->description = str_replace ( 'i?n', 'ë', $this->description );
//$this->title = str_replace ( 'i?n', 'ë', $this->title );
$this->title = str_replace ( 'é', 'é', $this->title );
$this->title = str_replace ( '&', '&', $this->title );
$this->title = str_replace ( 'ë', 'ë', $this->title );
$this->title = str_replace ( 'ë', 'ë', $this->title );
$this->title = str_replace ( 'Â’', '\'', $this->title );
$this->title = str_replace ( '‘', '\'', $this->title );
$this->title = str_replace ( '‘', '\'', $this->title );
$this->title = str_replace ( '’', '\'', $this->title );
$this->title = str_replace ( '[image1_left]', '', $this->title );
$this->title = str_replace ( '€', '€', $this->title );
$this->title = str_replace ( 'ï', 'ï', $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
|
|
|
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2002
Location: Clogland
Status:
Offline
|
|
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".

|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2002
Location: Clogland
Status:
Offline
|
|
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.
)
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2002
Location: Clogland
Status:
Offline
|
|
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.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|