史萊姆論壇

史萊姆論壇 (http://forum.slime.com.tw/)
-   網路軟硬體架設技術文件 (http://forum.slime.com.tw/f133.html)
-   -   解決UTF-8編碼VBB3附件下載名亂碼問題 (http://forum.slime.com.tw/thread131518.html)

psac 2004-10-30 10:00 PM

解決UTF-8編碼VBB3附件下載名亂碼問題
 
開啟attachment.php文件,找到

PHP程式碼if ($extension != 'txt')
{
header("Content-disposition: inline; filename=\"$attachmentinfo[filename]\"");
header('Content-transfer-encoding: binary');
}
else
{
// force txt files to be downloaded because of a possible XSS issue
header("Content-disposition: attachment; filename=\"$attachmentinfo[filename]\"");
}


在前面加上

PHP程式碼$cmd = "echo '$attachmentinfo[filename]' | iconv -f UTF-8 -t GB2312";
$attachmentinfo[filename] = shell_exec($cmd);


也就是將$attachmentinfo[filename]從UTF-8轉成GB2312,若是您的PHP有 iconv模組則更加方便,直接用函數就成:),我的空間沒有

下面請大家幫進行測試,看是否正常

做完系統後沒有安裝Firefox,請朋友們在Firefox下試試


所有時間均為台北時間。現在的時間是 06:39 AM

Powered by vBulletin® 版本 3.6.8
版權所有 ©2000 - 2024, Jelsoft Enterprises Ltd.

『服務條款』

* 有問題不知道該怎麼解決嗎?請聯絡本站的系統管理員 *


SEO by vBSEO 3.6.1