PHP output showing little black diamonds with a question mark(help)

Par naimo, il y a 10 ans


I'm writing a php program that pulls from a database source. Some of the varchars have quotes that are displaying as black diamonds with a question mark in them (�,)
How can I use php to strip these characters out?

7 réponses

TransientDev, il y a 10 ans

Hi,
can't you just change the charset in your html template?

naimo, il y a 10 ans

yes I put

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

and problem still unsolved

Azorgh, il y a 10 ans

Check youre file encoding. Set it to UTF8.
We need more precision about this problem. If you juste 'echo ' a special char, it's ok ?
Or maybe it's a var from a database ? If it, it's different !

naimo, il y a 10 ans

yes it's a var from a database

Benjamin Derepas, il y a 10 ans

If you are using PDO extension, you can force charset by using params into your PDO objetct

$dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass, array( PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")
naimo, il y a 10 ans

yeeeessss it's wwork thanx @Benjamin can I have your email or facebook account ??

naimo, il y a 10 ans

Thanx PallMallShow and TransientDev :D