Jump to content

showing non-english text after using htmlentities() !!


hassank1

Recommended Posts

Hii I am using this function to disable html...

 

function cleanText($text,$WrapWidth) //clean post from html + wordwrap + convert \n to <br>
{
$text=htmlentities($text); //disable (html and script code) -> for security reasons
$text=stripslashes($text); //convert (/') => (')
$text=wordwrap($text, $WrapWidth, "\n"); //replace \n by <br> and make a wordwrap
$text=wordwrap($text, $WrapWidth+5, "\n", true); 	 
$text=nl2br($text);
return $text;
}

 

however the non-english text are changed to ex:

 

;&#1608;&#1605;

&#1601;&#1605;&#1575; ...

 

how can I display this text and still disabling the other html tags !!

If you want to remove all html tags you can just use strip_tags function. htmlentities will convert all characters which have an html entity equivalent will be converted. If you only want to convert only html characters then use htmlspecialchars

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.