mrpatg mrpatg - 3 years ago 70
PHP Question

removing strange characters from php string

this is what i have right now

Drawing an RSS feed into the php, the raw xml from the rss feed reads:

Paul’s Confidence


The php that i have so far is this.

$newtitle = $item->title;
$newtitle = utf8_decode($newtitle);


The above returns;

Paul?s Confidence


If i remove the utf_decode, i get this

Paul’s Confidence


When i try a str_replace;

$newtitle = str_replace("”", "", $newtitle);


It doesnt work, i get;

Paul’s Confidence


Any thoughts?

Answer Source

Try this:

$newtitle = html_entity_decode($newtitle, ENT_QUOTES, "UTF-8")

If this is not the solution browse this page http://us2.php.net/manual/en/function.html-entity-decode.php

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download