Discuz the best way to transcode UTF-8 from GBK

Source: Internet
Author: User
Tags import database

Recently due to the integration of the Forum account needs, had to convert the original Blue Card forum GBK code to UTF-8, because the Discuz official did not provide conversion tools, online and there is no reliable tutorial, and the forum data more, can not be able to slip, which makes me very embarrassed.

I first tried the online comparison of a popular use of Discuz database functions for database backup, restore to achieve the purpose of conversion, but after I follow the tutorial, found that although the front desk posts, users and other data recovery, but the background of all the data lost! And there are some garbled cases appear, to reset so many background options, I do not do! So, I began to think of another conversion method, when I saw another tutorial, let us use the text Editing tool to manually convert the DZ program file encoding and then convert the database code to achieve the method of conversion purposes (almost unsuccessful), I suddenly brainwave, think of! This method has a very high success rate! Here is a detailed tutorial:

Backup

Anyway, backup is a must!

New Installation discuz!

First of all, we have to go to discuz official website to download the UTF-8 version of Discuz (must be with the GBK forum version), and a new installation of it to the server, it is best to use a separate subdomain, and a separate database, easy to follow, note: The database prefix is best with the GBK forum, of course, If you can't use more databases, you can only install GBK and UTF into the same database, that's another story! (The following operations are based on the two forums installed on different databases, if the two forums installed in the same database, some operations may be problematic, make sure to back up!) )

Convert Database encoding

The best way to convert database encoding is to import and export, first in phpMyAdmin to export the GBK forum database as a SQL file, encoding select Utf-8, download to local, open it with Notepad, find CHARSET=GBK Replace with Charset=utf8

Import Database

After the replacement, delete all the data tables of the UTF8 forum , and then use phpMyAdmin to import the SQL file just modified, encoding selection Utf-8, after the import is complete, the database conversion is complete! Note: If the data table prefixes of the GBK Forum and UTF Forum are different, the data table prefix must be modified in the config_global.php in the Config directory of the UTF forum after importing the database, otherwise it will not work properly!

Conversion templates and plugins

After the conversion of the database, the forum can not directly begin to use, because the GBK forum to use the plug-in and template can not be applied to the UTF-8 forum, first we need to GBK forum Source/plugin directory to the new forum, and then into the new forum backstage "plugin" option, to plug-in attempt to uninstall, If the normal pop-up uninstall prompt plug-in does not care, if the uninstall prompt "plug-in File missing", you need to re-enter the database, find the data table Pre_common_plugin (pre is your table prefix), remove the hint "plug-in File missing" plug-in, Then re-install in the background (note: If the prompt does not install, please refer to this tutorial to modify the DZ file before attempting to install: http://blog.csdn.net/luxiaoyu_sdc/article/details/7666864) in this way to deal with, Until all the plugins can be uninstalled properly, the processing of the plug-in is complete! Note: If a plugin is found to be deleted in the data table and cannot be installed in the background, then the plugin does not support UTF-8 encoding and needs to manually convert the encoding and add UTF-8 encoded XML to the plugin, see: http://www.wanghailin.cn/scka/ discuz-plugin-utf/, note that using this method for processing, the plugin settings will be lost, you can manually copy the plug-in settings from the GBK forum parameters

Next, the conversion template, the template directory of the GBK forum you use to copy the template to the UTF-8 forum, and download the template to the local, will contain Chinese characters of the file with Notepad to save as can, do not recommend the use of Bulk encoding conversion tool to encode the template conversion, prone to problems, After conversion is complete, re-upload, you can use!

Verify whether the conversion succeeded

Enter the new forum Discuz backstage, choose Webmaster-Database-check, database check, if the prompt "your database is complete and correct" is the conversion perfect success, otherwise, will detect the wrong encoding data table export, and then use the above substitution method to convert the code, delete the corresponding data table in the database, and then import it!

Migrating to the main forum

At this point, the entire conversion process is over! If there is no problem, then the old forum backup can be deleted, delete the old Forum data Sheet and program files, the new forum can be copied to the old forum directory, but I personally feel that the database is not necessary to replace, delete the old forum database on line, note: If the migration involves the change of the domain name, Be sure to modify the Ucenter communication address in the background, enter Ucenter to see the success of the communication, that is, the successful migration! (Because the UC database is also restored, the communication key may be the old forum, please pay attention to the replacement, otherwise cannot communicate successfully)

Small problem

Due to the structural differences in some of the data sheets of the UTF-8 and GBK forums, which may cause some of the functions to be abnormal after hard conversion, such as setting up personal data, there is a great possibility of problems after conversion, please refer to this paste method to solve (discuz! X3 test pass): http://www.discuz.net/thread-2536784-1-1.html

Summarize

This conversion method success rate is very high, but a little trouble, the webmaster Friends of the technical basis also have certain requirements, small white webmaster or do not try, this method after conversion, background settings can be relatively complete save, user name and so on will not appear garbled (so far I have not found any place has garbled appearance), However, the conversion of a very small amount of background data will be lost, but does not affect the normal use, just simple settings!

Discuz the best way to transcode UTF-8 from GBK

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.