Preliminary Reading

The following article describes the problem very well. Getting out of MySQL Character Set Hell. If instructions in my article do not help you, then you may need to follow the more involved instructions of this article.

 

"The reason that we do the conversion is that MySQL v4.0.x doesn't bother to specify a character set while using latin1. v5.0.x on the other hand uses utf-8 by default if no type is specified. Therefore if we simply copy a database from 4.0.x to 5.0.x the data will be corrupted as it will be wrongly assumed to be utf-8 instead of latin1. We chose to convert data to utf-8 instead of telling v5.0.x we were importing latin1 because utf-8 is the standard now and because doing that requires less massaging of the data."

Since MySQL 4.1, UTF-8 is the default charset. If you have an old database, containing data encoded in latin1, and you want upgrade to a newer MySQL server, then you can follow my instructions to convert your data to UTF-8 instead.


You need to make a dump with the parameter --default-character-set set to the value of the source database (latin1), change the charset of the db and tables in the txt file and the restore it with the charset of the target database (utf8).

 

 

Note that in addition to setting the format of any new tables created by your CMS the DB_CHARSET property defines the format of content sent to your database and the expected format of content retrieved from it. It does not alter the format of existing tables, so if you have tables formatted with a different character set from the one in DB_CHARSET the results will be erratic both in terms of fetching and saving text.

latin1 is the tragic default of MySQL version 4 and the most likely to be the problematic format of older copies of web software. UFT8 is the best way to support all Internet-friendly languages.

 

An article which describes things to try before messing with this procedure, to make sure it is not just your settings which are causing the whole problem: http://stackoverflow.com/questions/346531/utf8-problem-with-mysql-5

Another article: http://stackoverflow.com/questions/4777900/how-to-display-utf-8-characters-in-phpmyadmin

Try first to troubleshoot your code, if it is a custom piece of software which is causing the problem: http://stackoverflow.com/questions/3078845/encoding-problem-in-phpmyadmin-specifically-with-records-containing-russian-tex

Check your hosting environment settings: http://stackoverflow.com/questions/3021769/how-to-display-a-mysql-table-data-in-another-language-properly-in-php/3021908#3021908

Also ask your hosting provider about the setting in the MySQL INI file.

An article about encoding: http://code.openark.org/blog/mysql/mysqls-character-sets-and-collations-demystified



˅˅˅ Additional valuable information is available at one of the links below: ˅˅˅

 

Did you like the article? Let Google Search know by clicking this button: . Please link to content that you find useful on this website on your own website, forum or blog! You can also comment on this page below, or contact me to ask a question or suggest a topic for me to research. There is a user-editable Wiki available on my website, as well as a Forum that you can contribute to. Site Map.

Page last modified 31-Dec-12 21:54:37 EST
Comments on this page:


Add a comment to this page
Comment Title:
Your Name:
Your Email Address:
Notify me of new comments to this item:
Additional Comments:
This is a captcha-picture. It is used to prevent mass-access by robots. (see: www.captcha.net)