Special characters and php/xml/flash
First time poster! hope this isnt too newbie...
I'm trying to use the code here:
in order to convert text to the ASCII code necessary to display it in Flash. The problem is that it uses letter-based special character codes, like ˜, rather than something like "& # 8 2 1 2 ;" (spaces added so you can see it in the browser), and its not reading in flash. Is there a similar function which converts special characters to number-based instead of letter-based ascii code?
I played around with some things and came up with this little script, from which you should be able to use the functions to accomplish your needs:
$text = htmlentities($text);
$text = preg_replace('/(&\w+;)/e', "convert_entity('\\1')", $text);
# Try it out:
$test = 'This <b>is</b> a "test".';
$result = html_numeric_entities($test);
echo "BACK TO ORIGINAL:\n".html_entity_decode($result);
Wow thanks NogDog! I'll give that a try. So the final result of this script would be numeric value, eg rather than "& a m p ; " it would be "& # 3 8 ;"?
Yes. Just add the two function definitions to your script, then call the html_numeric_entities() function, specifying the initial (unencoded) string that you want converted.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)