This article mainly introduces the steps of converting Dreamweaver GBK/GB2312 to utf-8 encoding (site-wide modification method). Friends who need it can refer to it
Currently, MIP has strict requirements for encoding, and it must be It is UTF-8, so 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 garbled mess.
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. The details are explained below.
★ TranscodingPreparation work——Back up the original GBK website
Before transcoding, we need to have some preparation work and Notes
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 , (or use Imperial Backup King)
System - System Settings - Database Backup/Restore The database form appears here,
Click "OK" here to perform database backup, according to the database size, backup time Different lengths.
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 the webpage editor to transcode the template.
★ Transcoding work dismantling database transcoding
Database transcoding, I tested several methods and found that transcoding is the safest The complete way is to use the empire data backup
template download address www.php.cn/xiazai/code/dedecms. We get the
upload in the compressed package. You can change it to another name and put it in the website. For example, I changed it to shuju
and then put this directory under the website. The access address is domain name/shuju
. The default background admin password is 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 randomverification code, modify it yourself)
Then click "Backup Data" under "Backup and Restore Database"will The database of your original website appears, click "Backup Data" behind the databaseThe 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 the database backed up 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. You need to use it when Click "Start Backup" below and the backup will be done automatically in a whileAfter the backup is completed, we need to restore the transcoded database back. Let's first proceed with the program and Template transcoding, after the program and template are transcoded, we restore the database. ★Transcoding work dismantling program transcoding
Program transcodingThe general steps are, after completing the backup, keep the backup package, and then Clear the website space (only clear the data of the website space, Empire Data Backup King does not need to clean, you still need to use it to restore the data!), download the new UTF-8 program, and install, At this point, the transcoding work of the program part is completed.
Download and decompress, the files we get in uploads are the core files of the program,Upload 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. Generally, you don’t need to change anything else, especially Try not to change the Cookie Encryption code. Others can be changed in the background.
Do not check the initialization data to experience it. Just click 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 dismantling 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 file, you need to find it yourself, replace and transcode it. Since the template file and the style file 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. ……
Open one of the template files with dreamweaver.
Click Modify - Page Properties - Title/Encoding - Encoding, and what should appear at this time is as shown in the figure
We will Select Simplified Chinese (GB2312) as Unicode (UTF-8),
and click OK. The template file will be successful. Follow this method to extract all Template file for transcoding. 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, the program is transcoded but the data is blank, and the template is transcoded
At this time, use the Imperial Data Backup King to restore the database.
The following steps are to log in to the domain name/shuju
Click on the restore data under "Backup and Restore Database" and select the data The source directory 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 recommended
2. Transcoding Then log in to the backend, click System Settings-Basic System Parameters, click OK in Site Settings
3. If there is an error in the generation or template, click Generate-Automatic Task-UpdateSystemCache
4. Try to use the Dreamweaver template tag The most compatible template tag
The transcoding process of DreamWeaver can also be applied to other PHP CMS systems for transcoding.
If you have any questions, please reply to the post for discussion, and I will spare no effort to correct it...because I am the one who fixes the cards...
The above is the detailed content of Detailed introduction to the steps of converting Dreamweaver GBK/GB2312 to UTF-8 encoding (site-wide modification method). For more information, please follow other related articles on the PHP Chinese website!