PHP How to encode text to numeric entity?

Viewed 2193

I have xml like this:

<formula type="inline">
    <default:math xmlns="http://www.w3.org/1998/Math/MathML">
        <default:mi>
            &Zopf;
        </default:mi>
    </default:math>
</formula>

My goal is to get rid of all special entities like &Zopf; by replacing them by their numeric entity presentations.

I tried :

$test    = <content of the xml>;
$convmap = array(0x80, 0xffff, 0, 0xffff);
$test    = mb_encode_numericentity($test, $convmap, 'UTF-8');

But this will not replace the &Zopf; Any idea?

My goal is to get:

&#8484; 

as shown here: http://www.fileformat.info/info/unicode/char/2124/index.htm

Thank you.

2 Answers
Related