- PR -

日本語ダウンロードファイル名の文字化け(Apache + Tomcat)

1
投稿者投稿内容
みやも
ベテラン
会議室デビュー日: 2002/04/22
投稿数: 74
投稿日時: 2003-02-19 15:15
お世話になります。

Windows環境のApache+Tomcatで
日本語ダウンロードファイル名が文字化けするのですが、
対処法をご存知でしたら、教えていただけないでしょうか?

#Tomcat単体では正しく動作する(文字化けしない)のですが、
Apacheと組み合わせると文字化けします。

■環境
Windows2000
JDK1.4
Tomcat4.1.12-LE
Apache1.3.27
mod_jk-1.3

■サーブレットコード(抜粋)
res.setContentType("application/octet-stream");
String fileName = "そんな.txt";
fileName = new String( fileName.getBytes("Windows-31J"),"ISO8859-1");
res.setHeader("Content-Disposition",
"attachment;filename=\"" + fileName + "\"");
OutputStream out = res.getOutputStream();
out.write(new byte[]{1,1,1,1,1});
out.flush();

■レスポンスヘッダのログ
[Tomcat単体]
HTTP/1.1 200 OK
Content-Type: application/octet-stream
Content-Disposition: attachment;filename="そんな.txt"
Transfer-Encoding: chunked
Date: Wed, 19 Feb 2003 05:42:50 GMT
Server: Apache Coyote/1.0

[Tomcat+Apache]
HTTP/1.1 200
Date: Wed, 19 Feb 2003 05:44:21 GMT
Server: Apache/1.3.27 (Win32) mod_jk/1.2.2
Content-Disposition: attachment;filename="ツつサツづアツづ?txt"
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: application/octet-stream


何かの設定の問題かもしれませんが、
わけわかんない状態です。
よろしくお願いします。
1

スキルアップ/キャリアアップ(JOB@IT)