1 Vote Vote

Charset problem upon publishing PHP + MySQL website

Posted by topdog 337 days ago Questions| charset php content All

I have published my website to a server but I'm tearing off my hair due to character problems. Locally it all works fine despite any dumbness of mine (unclear or mismatched charsets). Let's take just one table as example because it satisfies our conditions:

My local scenario

  • PHP 5.3.0
  • Apache 2.2.11
  • MySQL 5.1.36-community-log
    • connection: utf8_general_ci
    • database: latin1_general_ci
    • table: latin1_general_ci
  • google chrome browser v. 12.0.742.100 w/ charset ISO-8859-1
  • php page charset set as: <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  • local: notice the words "Matéria" - comes from html - and "Notícia" - comes from database - both display the accents correctly:

expected behaviour locally

My host scenario

  • PHP 5.3.6
  • IIS running FastCGI
  • MYSQL 5.5.13
    • connection: utf8_general_ci
    • database: latin1_general_ci
    • table: latin1_general_ci
  • google chrome browser v. 12.0.742.100 w/ charset ISO-8859-1
  • php page charset set as: <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  • host: notice how "Notícia" has trouble showing itself:

wrong behaviour on host

I've read a few stuff, including this very good article stablishing a common ground for developers.

I have considered:

  • the problem being the actual data in the tables (despite it having a latin1_general_ci collation maybe the data is actually stored differently as this mate states it);
  • the problem having some ackward relation to IIS (when one runs PHP under IIS one has a tendency to blame IIS often);
  • my innacurate programming skills playing tricks on me once again

anyone offering some help? I can offer some brazilian portuguese lessons, some advice on spiritual life or just a little chat about anything, but I must solve this problem and you may be able to help me.

thanks in advance,

Originally asked by: marquito on Stack Overflow

Discuss Bury


Who Voted for this Question