php - Encoding problem when using htmlentities method -


i've problem of character encoding in php, this's php code:

n_event=$_get['ndlann']; $nom_complet=htmlentities(stripslashes($_post['nom'])); $email_comment=htmlentities(stripslashes($_post['email'])); $titre_comment=htmlentities(stripslashes($_post['titre'])); $texte_comment=htmlentities(stripslashes(nl2br($_post['commentaire']))); $pays_comment=$_post['pays']; $date_ajout=date('y/m/d'); 

data added in database table , see data comes comments form, when user enters comments orient languages carachters (arabic,hebrew...etc), input data change :

Ø´Ù�را عÙ�Ù� اÙ�Ù�Ù�ضÙ�Ø

i tried delete htmlentities method , works fine , start problem of comments form security (js scripts executed)

what can situation?

and thanks

do not use htmlentities() ever.

this function has been obsoleted long time ago. use htmlspecialchars() instead.

you have bunch of nonsense in code

  • doing htmlentities(nl2br(*)) has no sense.

  • make stripslashes conditional, if magic quotes set on.

  • there possible problem pays field.

  • i afraid you're taking htmlentities sort of sql escaing function. right?


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -