NYCPHP Meetup

NYPHP.org

[nycphp-talk] Character set issues revisited

John Campbell jcampbell1 at gmail.com
Fri Oct 19 21:07:08 EDT 2007


I think people are trying to diagnose a problem with incomplete
information.  There are a bunch of places where things can go wrong
with character encoding, and without the details it is impossible to
know what is going on.

What is the collation of the column in the database? (available in phpmyadmin)

What is the value of the "Content-Type" header? (use firebug to determine)

Which mysql drivers are you using? mysql,mysqli, pdo

Are you calling mysql('set names ...') anywhere?

Do you have a <meta http-equiv="Content-Type" ..> tag?

And by '?' do you mean '?' or '�' ... there is a big difference.

My guess is that you are using utf8 as the database collation, and you
need to remove your meta tag, call mysql_query("set names utf-8") as
soon as you create a connection to the database, and add a
header("Content-Type: text/html; charset=utf-8"); to all scripts.

But again, that is a guess since I only have about 20% of the relevant info.

Hope that helps.

Regards,
John Campbell


More information about the talk mailing list