Reuben Sant wrote:

Hi,

Is there a way to convert any character to it's HTML &#xxx; equivalent in
PHP?

For example A is the letter "A" where the number 65 represents it's
ASCII code.


This may help. It's a function from Tom Rogers, or was it Tim Rogers, I can't remember.


function clean_ms_word($original)
{
$crap = array(chr(0x82),chr(0x83),chr(0x84),chr(0x85),chr(0x86),chr(0x87),chr(0x88),chr(0x89),chr(0x8a),chr(0x8b),chr(0x8c),chr(0x91),chr(0x92),chr(0x93),chr(0x94),chr(0x95),chr(0x96),chr(0x97),chr(0x98),chr(0x99),chr(0x9a),chr(0x9b),chr(0x9c),chr(0x9f));
$clean = array('‚','ƒ','„','&ldots;','†','‡','','‰','Š','‹','Œ','‘','’','"','"','•','–','—','˜','™','š','›','œ','Ÿ');
$content = str_replace($crap,$clean,$writing);
return $content;
}


$new = clean_ms_word($original);

$crap is the stuff you don't want.
$clean is the stuff you want.

So, chr(0x82) would become &lsquor.

HTH,
Roger

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to