How to decode numeric HTML entities in PHP

Posted by Yuriy on Stack Overflow See other posts from Stack Overflow or by Yuriy
Published on 2010-05-04T11:22:50Z Indexed on 2010/05/04 11:28 UTC
Read the original article Hit count: 423

Filed under:
|
|

Hello,

I'm trying to decode encoded long dash from numeric entity to string, but it seems that I can't find a function which can do this properly.

The best that I found is mb_decode_numericentity(), however, for some reason it fails to decode long dash and some other special characters.

$str = '–'; // <- ' & # 8211 ;'

$str = mb_decode_numericentity ( $str , Array(0xFF, 0x2FFFF, 0, 0xFFFF) , 'ISO-8859-1');

This will return "?".

Anyone knows how to solve this problem?

© Stack Overflow or respective owner

Related posts about php

Related posts about htmlentities