Jump to content

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


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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.