Re: Special HTML characters question.

From: Date: Mon, 22 Aug 2005 14:15:09 +0000
Subject: Re: Special HTML characters question.
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-221094@lists.php.net to get a copy of this message
Hi, Here are two routines for your problem. function htmlentities2($myHTML) { $translation_table=get_html_translation_table (HTML_ENTITIES,ENT_QUOTES); $translation_table[chr(38)] = '&'; return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&amp;" , strtr($myHTML, $translation_table)); } function displaytextData($variable){ $variable = eregi_replace("&quot;",'"',eregi_replace("&amp;","&",eregi_replace("&lt;","<",eregi_replace("&gt;",">",htmlentities2($variable))))); $variable = trim($variable); return $variable; } Hopefully this will help a lot... Enjoy... ;) -- *** phpgurru.com <http://phpgurru.com> [A php resource provider] *** \\\|/// \\ - - // ( @ @ ) PHP is too logical for my brain +---oOOo-(_)-oOOo------------------------------------------+ | Mian Shafiq ur Rehman | phpgurru.com <http://phpgurru.com> [A php resource provider] | 107 B, New Town, Multan Road | Lahore Pakistan | | Mobile: 0300 423 9385 | | ooo0 http://www.phpgurru.com | ( ) 0ooo E-Mail: rehmanms@gmail.com +---\ (----( )------------------------------------------+ \_) ) / (_/

« previous php.general (#221094) next »