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

Posted on 2008-11-05
Last Modified: 2012-05-05

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

Question by:Daniish
    LVL 6

    Accepted Solution

    This should work for you:


    Open in new window

    LVL 6

    Assisted Solution

    For additional characters, check out:
    LVL 82

    Assisted Solution

    replace it with:

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

    Open in new window

    LVL 11

    Assisted Solution


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

    Use htmlentities instead.

    Everytime that you need special chars inside a XML use CDATA

    <tag><![CDATA[YOUR CONTENTS GOES HERE]]></tag>

    Author Comment

    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 :)

    Author Closing Comment

    I forgot to apply the replacement of special characters to the individual attributes being returned from my database - all sorted now.

    Many thanks :)

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
    This article will show, step by step, how to integrate R code into a R Sweave document
    The viewer will learn how to dynamically set the form action using jQuery.
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now