1

주제: 첨부파일에 한글이 있을 경우 깨집니다.

첨부파일에 한글이 있는 경우 다운로드시 깨집니다.

제가 사용중인 버전은 1.8.3.1이고, PHP 5.3입니다.

아래와 같이 수정하면 Firefox/IE에서는 한글로 받을 수 있더군요.

tc/interface/blog/attachment.php
line 24에 아래와 같은 내용 추가

$user_agent = $_SERVER['HTTP_USER_AGENT'];
$is_msie6 = false;
$msie6_str = strstr($user_agent, 'MSIE');
if($msie6_str != FALSE)
    $is_msie6 = true;

$file_label = $attachment['label'];
$file_label_encoded = rawurlencode($file_label);
$file_label_base64 = '=?utf-8?b?' . base64_encode($file_label) . '?=';

line 25를 아래와 같이 변경합니다.
원본

header('Content-Disposition: attachment; filename="' . rawurlencode(UTF8::bring($attachment['lab    el'])) . '"');

수정본

if($is_msie6)
    header('Content-Disposition: attachment; filename="' . $file_label_encoded . '"');
else
    header('Content-Disposition: attachment; filename="' . $file_label_base64 . '"');

이렇게 하면 IE에서는 한글이 보이기는 하는데 [1]같은 문자가 추가되더군요. 자세한 테스트는 안 해봐서 모르겠습니다.

noneofnone (2010-04-06 19:36:41)에 의해 마지막으로 수정

2

답글: 첨부파일에 한글이 있을 경우 깨집니다.

내용 추가합니다.
사파리와 오페라는 원본 그대로 출력하니 되네요...

line 24 :

$user_agent = $_SERVER['HTTP_USER_AGENT'];
$is_msie6 = false;
$is_safari = false;
$is_opera = false;
$msie6_str = strstr($user_agent, 'MSIE');
$safari_str = strstr($user_agent, 'Safari');
$opera_str = strstr($user_agent, 'Opera');
if($msie6_str != FALSE)
    $is_msie6 = true;
if($safari_str != FALSE)
    $is_safari = true;
if($opera_str != FALSE)
    $is_opera = true;

line 25 :
원본

header('Content-Disposition: attachment; filename="' . rawurlencode(UTF8::bring($attachment['lab    el'])) . '"');

수정본

if($is_msie6)
    header('Content-Disposition: attachment; filename="' . $file_label_encoded . '"');
else if($is_safari || $is_opera)
    header('Content-Disposition: attachment; filename="' . $file_label . '"');
else
    header('Content-Disposition: attachment; filename="' . $file_label_base64 . '"');