My host environment is Windows IIS. After installing WordPress, I have modified part of the code in class-wp.php according to the online method, and converted the characters from GBK to UTF-8. After that, articles with Chinese characters in the URL can be opened normally, but now I find that the Chinese tag names in the tag page are still garbled.
The previously modified conversion encoding (line 177 of class-wp.php was modified to the following code):
$pathinfo = isset( $_SERVER['PATH_INFO'] ) ? mb_convert_encoding($_SERVER['PATH_INFO'], "UTF-8", "GBK") : ''; //修改处
list( $pathinfo ) = explode( '?', $pathinfo );
$pathinfo = str_replace( "%", "%25", $pathinfo );
list( $req_uri ) = explode( '?', mb_convert_encoding($_SERVER['REQUEST_URI'], "UTF-8", "GBK") ); //修改处
$self = $_SERVER['PHP_SELF'];
$home_path = trim( parse_url( home_url(), PHP_URL_PATH ), '/' );
$home_path_regex = sprintf( '|^%s|i', preg_quote( $home_path, '|' ) );
Now the Chinese garbled characters of the tag are as follows:
<a class='page-numbers' href='https://xxx.com/tag/����/page/2'>2</a>
<a class='page-numbers' href='https://xxx.com/tag/����/page/3'>3</a>
<a class='page-numbers' href='https://xxx.com/tag/����/page/4'>4</a>
<a class='page-numbers' href='https://xxx.com/tag/����/page/5'>5</a>
<a class='page-numbers' href='https://xxx.com/tag/����/page/6'>6</a>
For Chinese tags, there is no problem on the first page, but the tags on subsequent pages become garbled. I checked in the database and the encoding is correct. I have not installed caching or paging plug-ins.
After that, I searched on Google. The most common way was to modify the first code, but I had already modified it before and it didn't solve the problem. I tried some other methods but it didn't work. Please tell me what the problem is.
Owner, when you installed the text, did you use the GBK encoding format? I just changed the declaration part inside. Has the file also been changed to UTF-8?