My development work is in Mac OS x, and WordPress is UTF-8 code, in the new version (I use all 3.0.3) you can store, display, and download Chinese attachments in WordPress.
However, when you deploy the website on a Windows XP Chinese version, you will find that the uploaded attachments are garbled in the server file name, while the URL is normal, which indicates that it is a problem of operating system encoding, the Windows Chinese Version code seems to be GBK (the system code output during development in Windows previously seems to be GBK. If you are interested, you can test it in Windows ). Solution:
1. If you have to deploy WordPress on Windows XP, replace the Windows XP English version.
2. If you have to deploy Wordpress to the Chinese version of Windows XP, modify the followingCode:
//WP-admin/shortdes/file. phpTake 3.0.3 as an example:
Function wp_handle_upload (& $ file, $ overrides = false, $ time = NULL ){//.... // move the file to the uploads dir // $ new_file = $ uploads ['path']. "/$ FILENAME"; // fixed the Chinese file name encoding problem $ new_file = $ uploads ['path']. "/". iconv ("UTF-8", "gb2312", $ filename );//... // return apply_filters ('wp _ handle_upload ', array ('file' => $ new_file, 'url' => $ URL, 'type' => $ type ), 'upload'); // fixed the problem of Chinese file name encoding. Return apply_filters ('wp _ handle_upload ', array ('file' => $ uploads ['path']. "/$ FILENAME", 'url' => $ URL, 'type' => $ type), 'upload ');
The iconv ("UTF-8", "gb2312", $ filename); can also be encoded using GBK.