Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Change database to UTF8 from latin1

edited January 2007 in Vanilla 1.0 Help
I just changed my exist Chinese forum's database to utf-8 form latin1 with phpMyAdmin, and I want to help someone has this necessity also.

Why change it?
My website hosted in Dreamhost, and phpMyAdmin's charset is UTF-8, but my database is latin1, I can't view *any* correct Chinese characters on my phpMyAdmin page. Otherwise, it works fine. So, make sure you really need to change, and it has some risks.

How to?
1. Setup Apache, MySQL, PHP and phpMyAdmin on home computer. (You would like to use AppServ.)
2. If home computer is using windows, you have to add set-variable = lower_case_table_names=0 in the my.ini (MySQL configuration file) below [mysqld] to make table names don't change to lowcase. (http://www.phpmyadmin.net/documentation/#faq1_23)
Restart home computer's MySql Service.

3. Export forum's data with phpMyAdmin on forum's server. (and backup these file)
4. Create new database with any name (eg. utf8_temp) on home computer, use utf8_general_ci for the collation.
You would get some information like "CREATE DATABASE `utf8_temp` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;" form phpMyAdmin.
5. Open "utf8_temp"(or other name you choice), click the import page, choose "utf8" in the character set and import forum's data.
6. Now you can browse some tables of the database, it'll be same as the server.

7. Change home computer's phpMyAdmin source "phpMyAdmin\libraries\select_lang.lib.php", below // MySQL charsets map change:
'utf-8' => 'utf8', to 'utf-8' => 'latin1',Save file.
8. Refresh browser (also change view encoding to utf8), if the LUM_Comment table's(or other table that has non-latin character) character is correct, it almost success.
9. Export whole datebase with none compression and save to a sql file.
10. Open the new .sql file with your favorite editor, change all "latin1" to "utf8".
11. Similar step 7, change 'utf-8' => 'latin1', back to 'utf-8' => 'utf8',
12. Do again step 4 and step 5, *but* import the new .sql file you just modify, than make sure database's character is correct.


13. If anythings work fine, you can import the new .sql file to your forum server's new database. (same as step 12 but in forum's server)
14. Take a look with http://lussumo.com/vanilladev/discussion/126/mysql-utf8-and-cyrillic-characters-i-sh-displays-like-/#Item_1 (thanks 130) and make necessity change. (I only change Framework.Class.MySQL.php.)
15. Modify vanilla db's setting file(eg: forum/conf/database.php), change "$Configuration['DATABASE_NAME']"'s value to point to your new utf8 database.

14-15. Change the conf file setting as this document say.
16. Done. Now you can test your forum with the new utf8 database.

Other references: 1.0.1 issues(thanks Max_B give me some information)

@Sorry for my poor english, hope this can help someone. :P
This discussion has been closed.