This will convert all non alphanumeric characters to the appropriate HTML code:
<?php
function flashentities($string)
{
$ret = '';
$data = preg_split('#(?<=.)(?=.)#s
$skip = array_merge(range(0,32), range(48,57), range(65,90), range(97,122));
foreach ($data as $char)
{
$ord = ord($char);
if (!in_array($ord, $skip)) $ret .= "&#{$ord};";
else $ret .= $char;
}
return $ret;
}
$data = "& and '. However, can anyone also tell me the escape codes for – “ ”";
$data = flashentities($data);
echo $data;
?>
Main Topics
Browse All Topics





by: dereshPosted on 2007-02-16 at 00:05:20ID: 18546785
you could use html entites:
en/functio n.htmlenti ties.php
$clean_for_flash = htmlentities($string);
http://www.php.net/manual/