vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| After much reading and many questions on this forum, I have now reached the point where I am going to convert my db charset to utf8. Before I do, however, I want to run my plan by the folks here to see if it sounds right. Present situation: I am running MySQL 4.1.21, using PHP 5.2.0 on Linux with Apache 1.3.37. there is one database with default charset = latin1; all tables have the same latin1 default, and all string-type columns (varchar, text) have the latin1 default as well. All string-type data so far is within the 7-bit ASCII range. Objective: Convert everything - database, tables, columns and data to utf8. Plan: 1. Start on the command line and alter the database default: USE database_name; ALTER DATABASE database_name CHARACTER SET utf8; 2. Use ALTER/CONVERT on each table: ALTER TABLE table_name CONVERT TO CHARACTER SET utf8; (duplicate same line for each table) As I understand it, this second step not only sets the default charset for a table to utf8, it changes the defaults for the columns as well, including the attempt to convert all string data to utf8. Since all data so far is ASCII, that should work ok. 3. In my PHP scripts, after establishing the connection to MySQL, add the following line: mysql_query("SET NAMES 'utf8' "); Does the plan look ok? Have I left something out? I use Dreamweaver as a code editor. Do I have to somehow convert its output to utf8? Is there any adjustment required to the charset of my php scripts? |