Home > Article > CMS Tutorial > How to change the encoding method of dedecms
Modification method: 1. Back up the original website, use the background data backup function to back up the database, and package all files under the root directory of the website; 2. Use the transcoding tool to transcode the database; 3. Clear For website space information, download the new dedecms program and install it according to the new encoding method. You will get a blank, newly encoded Dream Weaver website; 4. Use web page editing software to batch encode the templates; 5. Import the transcoded data. A blank DreamWeaver website will do.
The operating environment of this tutorial: Windows 7 system, DedeCMS 5.7, DELL G3 computer
Currently MIP has strict requirements for encoding, it must be UTF -8, then for most users of GBK or GB2312, they can only convert the entire website encoding before performing MIP transformation, otherwise the transformed page will be a large mess of garbled code.
Why does MIP only support utf-8? At present, some mobile phone browsers only support UTF-8, and garbled characters will appear when opening GBK websites. Therefore, for the compatibility of mobile phones, MIP standardizes the encoding of web pages as UTF-8. At the same time, it is recommended that everyone try to use UTF-8 when making websites. Not only is it the mainstream international encoding, but the quality of the website will also be reduced. At the same time, this tutorial is applicable to cms of other PHP systems. The general principle is UTF-8 program replacement, template transcoding, and database transcoding. These three parts of the operation are. The details are explained below.
★ Transcoding preparation work - backing up the original GBK website
Before transcoding, we must have some preparations and precautions
First, back up the original website of GBK (GB2312). The steps are as follows:
First, use the background data backup function to back up the database, enter the background, and click
System - System Settings - Database Backup/Restore The database form appears here,
Click "OK" here to back up the database. The backup time varies according to the size of the database.
Second, wait for the database backup to be completed, package all the files under the root directory of the website, and back up
to where the website data and database backup are completed.
The purpose of backing up the entire site is to prevent the entire site from being restored after transcoding failure.
The complete Dreamweaver website is divided into three parts, program, template, database, we will convert these three parts in turn code operation.
The principle of transcoding is
Use Imperial Data Backup King to transcode the database,
Use DreamWeaver UTF-8 program to directly replace the GBK program,
Use a web page editor to transcode the template.
★ Transcoding work dismantling database transcoding
Database transcoding, I tested several methods and found that transcoding is the safest and most secure The complete way is to use Empire Data Backup King
We get
in the compressed package. This upload can be changed to another name and placed on the website, such as mine Change it to shuju
and then put this directory under the website. The access address is Domain name/shuju
Default background admin Password 123456
After logging in, a database setting appears. We need to enter and set the database address, database user, and database password used by the original website in sequence. (You may need to modify the default login password and random verification code, modify it yourself)
Then click "Backup Data" under "Backup and Restore Database"
The database of your original website will appear , click "Backup Data" behind the database
The page that appears at this time is very important but also very simple, just transcode here
Here We need to manually select utf8 and then back up the database, which is utf8, that is, it has been transcoded.
The storage directory needs to be remembered, because after we have backed up, we need to restore it, and we will use it when restoring
Click "Start Backup" below and the backup will be done automatically in a while
After the backup is completed, we need to restore the transcoded database back. Next, we will first transcode the program and template. The program and After the template is transcoded, we restore the database.
★ Transcoding work dismantling program transcoding
Program transcodingThe approximate steps are, after completing the backup , keep the backup package, and then clear the website space (only clear the data of the website space, Imperial Data Backup King does not clean , you still need to use it to restore the data!), download the new UTF-8 program, and install it. At this point, the transcoding work of the program part is completed.
Select UTF-8 to download, download and decompress, the file in uploads we get is the core file of the program, upload it to the website space
Detailed explanation of the installation steps. If you know how to install Dreamweaver, you can skip it here. Go directly to the next step of template transcoding.
Step 1, run your domain name/install/index.php
Step 2, check, I have read and agree to this agreement, Click to continue
Step 3. If Continue appears below, click Continue to the next step. As for the red cross, you generally don’t need to worry about it. If Continue does not appear, it means you need space. If there is a problem, please find the cause of the space yourself.
Step 4, this is the most important part. According to the picture above, we basically don’t need to choose anything when selecting the template. Let’s start the second part, database settings, here It involves several concepts: "database host", "database name", "database user", "database password", "data table prefix", and "database encoding". Please fill in the information completely against the space provider or the database information you created.
The third block is the administrator account and password. Fill it in by yourself.
The fourth block is the website settings. Change the website name to your own. You generally don’t need to change anything else, especially the cookie password. Try not to touch this, other things can be changed in the background
Do not check the initialization data to experience it, just click to continue, and the installation is complete!
I attach my installation parameters for everyone to take a look at.
The following interface appears to prove that you have successfully installed it
Transcoding part of the program That’s it. At this point, we get a blank UTF-8 DreamWeaver website.
★ Transcoding work disassembly and template transcoding
Please be sure to use professional web page editing software to perform this step!
I recommend that you use dreamweaver or Notepad. Of course, there are also small tools on the Internet for template batch GBK transcoding utf-8. Cannot be changed using Notepad! The front end can skip the template transcoding tutorial.
First of all, we need to separate our template files from the backed up website data. Among them are program template files, which are usually in a folder under the templates folder in the root directory of the website, as well as css and js files. , you need to find and replace and transcode by yourself. Since the template files and style files are different, I only use Dreamweaver to replace a web page for demonstration. In fact, the front-end laughed when I saw this. This is really nonsense...
Use dreamweaver to open one of the template files.
Click Modify - Page Properties - Title/Encoding - Encoding, and what should appear should be as shown in the figure
We select Simplified Chinese (GB2312) into Unicode (UTF-8),
##Click OK, the template file is successful, follow this method toall extracted template files, Transcode. After the transcoding is completed, upload it to the corresponding location of the newly installed UTF-8 website.
★ End of the transcoding work—restoring the website
At this point, the database is transcoded but not restored, and the program is transcoded but has blank data. Template transcoding is completedAt this time, use the Imperial Data Backup King to restore the databaseThe steps are to log in to the domain name/shuju and click "Backup and Restore Database" To restore data, select the data source directory, which is the directory where the database was backed up just now. Next, select the data table (that is, the original website data table) in "Database to be imported" and click to start recovery. After recovery, the original GBK database will be transcoded into utf8. Here, our website is completely transcoded from GBK to utf-8, and MIP can be transformed.★ Notes on transcoding
1. If the program has been modified or re-developed, transcoding is not recommended2. Log in to the backend after transcoding, click System Settings - System Basic Parameters, click OK in Site Settings 3, if there is an error in the generation or template, click Generate - Automatic Tasks - Update the system cache 4. Try to use the most compatible template tags for Dreamweaver template tags Dreamweaver’s transcoding process can also be applied to other PHP CMS systems for transcoding.
Recommended learning: dedecms tutorial
The above is the detailed content of How to change the encoding method of dedecms. For more information, please follow other related articles on the PHP Chinese website!