latin1_swedish_ci & iso-8859-1 [charset] [phpmyadmin]

latin1_swedish_ci is iso-8859-1, you need to set utf8.

Tables can be of a different character set than default database character set, specially if the character set has been changed after you created the created your database.

If you look on the front page of phpMyAdmin, you’ll notice that when you create a new database, it has a setting for “MySQL connection collation:”. Be sure when you create a new database that both that the database collation are set to utf8. It may be as simple as recreating a new database, copying your current one to the new one, then renaming it.

The collation is only used for sorting and comparison of text (that’s why there’s a language term in there). The actual character set may be different. The most common failure is not in the database but rather in the connection between PHP and MySQLThe default charset for the connection is usually ISO-8859-1. You need to change that the first thing you do after connectiong, using either the SQL query SET NAMES 'utf-8'; or the mysql_set_charset function.

 check to make sure that everything is properly UTF-8:

  • Make sure that you are serving your HTML as UTF-8:
    • header(“Content-Type: text/html; charset=utf-8”);
  • Change your PHP default charset to utf-8:
    • ini_set(“default_charset”, ‘utf-8’);
  • If your database doesn’t ALWAYS talk in utf-8, then you may need to tell it on a per connection basis to ensure it’s in utf-8 mode, in MySQL you do that by issuing:
    • charset utf8
  • You may need to tell your webserver to always try to talk in UTF8, in Apache this command is:
    • AddDefaultCharset UTF-8
  • Finally, you need to ALWAYS make sure that you are using PHP functions that are properly UTF-8 complaint. This means always using the mb_* styled ‘multibyte aware’ string functions. It also means when calling functions such as htmlspecialchars(), that you include the appropriate ‘utf-8’ charset parameter at the end to make sure that it doesn’t encode them incorrectly.

If you miss up on any one step through your whole process, the encoding can be mangled and problems arise. Once you get in the ‘groove’ of doing utf-8 though, this all becomes second nature. And of course, PHP6 is supposed to be fully unicode complaint from the getgo, which will make lots of this easier (hopefully)

via stackoverflow


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s




Just another site

Jing's Blog

Just another site

Start from here......







Just another site

Where On Earth Is Waldo?

A Project By Melanie Coles

the Serious Computer Vision Blog

A blog about computer vision and serious stuff

Cauthy's Blog

paper review...

Cornell Computer Vision Seminar Blog

Blog for CS 7670 - Special Topics in Computer Vision


Life through nerd-colored glasses

Luciana Haill

Brainwaves Augmenting Consciousness



Dr Paul Tennent

and the university of nottingham

turn off the lights, please

A bunch of random, thinned and stateless thoughts around the Web

%d bloggers like this: