Try multibyte functions (http://www.php.net/manual/en/ref.mbstring.php): mb_decode_numericentity mb_encode_numericentity mb_convert_encoding
See below: <?php function n_to_c($str) { return mb_decode_numericentity($str, array(0x0, 0x2FFFF, 0, 0xFFFF), 'UTF-8'); } function c_to_n($strt) { return mb_encode_numericentity($strt, array(0x0, 0x2FFFF, 0, 0xFFFF), 'UTF-8'); } echo n_to_c('“'); echo '<br/>'; echo c_to_n(n_to_c('“')); ?> Hope it helps, Lucian "Roland" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi > > I'm trying to encode text entered into an html form. In dreamweaver, > special characters seem to be encoded as “ (a curly quote) for > example, which I assume is utf-8. > > Here is my code snippet: > > htmlentities(html_entity_decode(strip_tags(stripslashes(trim($data)))), > ENT_QUOTES), ENT_QUOTES, "utf-8") > > but this does not seem to return the encoded value. I've tried all the > character sets, but none of them seem to do anything apart from the windows > specific character set, which doesn't return the value I want. > > I've tried using html_entity_decode with uft-8, but it throws an error > saying that the function doesn't support MBCS (Multibyte character sets???) > > I've also tried using utf8_encode() before trying to html encode, but this > doesn't work either. > > Any help gratefully appreciated > > Thanks In Advance > Roland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php