Afficher un message
Vieux 19/07/2007, 13h34   #3
Nis Jørgensen
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Foreign characters behaving oddly

Matthew White skrev:
> I added that query right after calling the database, and it now works fine,
> but here is a problem- "français" returns three matches:
> français
> française
> françaises
>
> Why is "ç" being substituted for "ç", even when I pass each returned
> string
> through htmlentities()?


Htmlentities will interpret what comes from the database as iso-8859-1,
while it is in fact utf-8.

Either use
htmlentities($myvar, ENT_QUOTES, 'utf-8')
or
htmlspecialchars($myvar)

I recommend the second option - if your output is utf-8, you should
hardly ever need htmlentities.

Nis
  Réponse avec citation
 
Page generated in 0,04286 seconds with 9 queries