On Sat, Sep 13, 2003 at 11:24:56AM -0700, Michael Winston wrote: : : The request: Can the macintosh character set be added as an option for : htmlentities() and other commands? That would be so helpful for our : mac-based company. : : The problem: I'm fairly new to php and have found that the macintosh : character set is pretty different from other standard sets, so when : someone in our company enters an em-dash (an extended dash, that would : be represented as &emdash; in html) into our SQL database, browsers : display it as Ñ (Ñ) because that's the correct mapping in other, : standard sets. Of course, I could do a replace on that character, but : there are another 6 characters that I know of that will cause problems, : and probably more beyond that. The quick and good way is to convert : with htmlentities(), but the mac charset is lacking. : : Any suggestions how to fix this?
You could modify the HTML translation table and add Mac specific characters to the mix. <?php $trans = get_html_translation_table(HTML_ENTITIES); $trans[chr(213)] = '&apostrophe;'; $trans[chr(165)] = '•'; $trans[chr(208)] = '&endash;'; $trans[chr(209)] = '&emdash;'; $macstring = 'A string containing some Mac-specific characters'; $encoded = strtr($macstring, $trans); echo $encoded; ?> I wonder if anyone has already done the work for the other entites. Anyways, if not, you can always build your own from Apple's list: http://developer.apple.com/documentation/mac/Text/Text-516.html#MARKER-9-3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php