|
|
Posted on 8/9/2017 9:43:27 AM
|
|
|
|

Now UTF8 is the mainstream of websites, because in domestic GBK-coded websites, there will be no garbled characters when opened
However, if you open a domestic GBK-coded website abroad, if your computer does not install the GBK-coded font library, it will cause foreign friends to open our website and display garbled characters
Moreover, UTF8 is an international encoding, and the disadvantage is that it occupies more space than GBK encoding in terms of storage
In short, converting to utf8 has many benefits, and the other steps of converting dz website gbk to utf8 are easy to do, and it is difficult to transcode in the database
dz in GBK and UTF8 databases, some storage is not the same
dz Some fields recorded in the "serialization code" are invalid in UTF8 due to the different character bits occupied by GBK and UTF8 characters.
Comparing the classification information, GBK is recorded like this:
{i:1; s:4: "Plot"; i:2; s:4: "Role"; i:3; s: 6: "cast and crew"; i:4; s:4: "peripheral"; i:5; s:4: "English"; i:6; s:4: "inventory"; i:15; s:4: "Resources"; i:16; s:4: "Information"; i:17; s:8: "related nouns"; }
Among them, the two words plot account for 4 characters, so it is written as s:4, which is invalid when placed in the encoding of utf8, because the correct writing of utf8 should be s:6, and two Chinese characters account for 6 characters. This record should be amended to:
{i:1; s: 6: "Plot"; i:2; s:6: "Role"; i:3; s: 9: "Cast and crew"; i:4; s: 6: "peripheral"; i:5; s: 6: "English"; i:6; s:6: "Inventory"; i:15; s:6: "Resources"; i:16; s:6: "information"; i:17; s:12: "related nouns"; }
The following figure shows a record in my GBK database table:
For these fields that are serialized and stored, how to convert GBK to UTF8 serialized format storage?
Some big bulls on the Internet have written tools, but the serialized table is incomplete, or there is a problem.
Because this website is where I transferred from GBK to UTF8, I found some problems and corrected them myself.
Just modify the following parameters
$dbserver = 'database address'; $dbusername = 'Database Account'; $dbpassword = 'database password'; $database = 'database name';
Then, after the modification is completed, upload php to any directory of the website and access the php file address! Finally, click on the button "Discuz!" Serialization and sorting".
php script download:
Tourists, if you want to see the hidden content of this post, please Reply
|
Previous:Mysql NN meansNext:LINQ left, right, and inner connections
|