£ is an invalid entity - what do i replace it with ?


I use the attached code to catch invalid entities from data held in mysql. I would like to add a line to this code to catch the pound symbol ' £ '

What should this be replaced with?

Where can i find a complete list of valid entities in case i need to add any other dodgy characters ?

Many thanks
function parseToXML($htmlStr)
$xmlStr=str_replace(chr(0x20).chr(0x10), '&#x2010;', $xmlStr);
return(htmlspecialchars(str_replace("#","<br /><br />",$htmlStr), ENT_QUOTES));
return $xmlStr;

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

This should work for you:


Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
For additional characters, check out: http://www.ascii.cl/htmlcodes.htm
replace it with:

the friendly name is not a "standard" xml entity.

Open in new window

Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).


htmlspecialchars don't convert all chars, just a few like < >;

Use htmlentities instead.

Everytime that you need special chars inside a XML use CDATA

DaniishAuthor Commented:
Thank you all for your suggestions - i have tried both of the following:


but neither have the desired effect, what could be going wrong ?

If you wish to see the currently unconverted symbols - please visit:
Then click on the England pushpin marker > the Norwich (SE England) Arrow marker > airplane icon
You will see in the right hand column that 3x £ symbols aren't being displayed!

Thanks again

p.s. excellent link cr4ck3rj4ck :)
DaniishAuthor Commented:
I forgot to apply the replacement of special characters to the individual attributes being returned from my database - all sorted now.

Many thanks :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.