Ive been around on the internet trying to find my answer, but I still haven't fond what I'm looking for. Just like Bono.

This is the case:

I got a form on internet which is sending information to a mysql table. (the form is called Processform and is made by Nate Baldwin, mind palette). The same form is also sent to my e-mail through the same PHP-script.

- The charset on the Mysql table is wrong. Norwegian letters as ÆØÅ, becomes weird symbols. WHILE on the E-mail, the symbols are correct.

I have tryed a lot of things. Ive changed charset to UTF-8 everywhere I can, and it doesn't make sense.

- Another thing is this: When i write the information from the form to a txt-file and tries to import it to an excel- file the characters also becomes messed up, BUT if I download the txt-file to my desktop and then import it to excel, it works fine.

Somebody had the same problem or know the answer, please shout "hallo"! And im really not a geek in this area. So be kind and spesific

There are several places the character set needs to be accounted for:

  1. Database Collation & Charset
  2. Table Collation & Charset
  3. Charset of the database connection

From within php:

Also if you are displaying the content the proper meta content-type header needs set in your html:

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

and you should also be pushing this to the user via php's header() function:

header('Content-Type: text/html; charset=UTF-8');

The last two are really only for displaying in a browser properly. I believe your issue relates to the mysql connection charset. Hope this helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.