W3C home > Mailing lists > Public > www-international@w3.org > October to December 2003

RE: Problem in downloading a pdf file having Japanese characters in the name of the file

From: Steve Billings <billings@global360.com>
Date: Thu, 30 Oct 2003 12:22:48 -0500
To: "souravm (by way of Martin Duerst <duerst@w3.org>)" <souravm@infosys.com>, <www-international@w3.org>
Message-ID: <AMEPLMAIGEILOIOPFNIHEEHEDPAA.billings@global360.com>

I wrestled with this problem earlier this year, and unfortunately found no
good solutions. As far as I can tell (and I hope someone can prove me
wrong), it's a yet-to-be solved problem in the internet infrastructure. I
was using recent versions of IE and Netscape browsers, and a not-so-new
version of Tomcat (3.something, I think).

The approach that came closest to working was to encode the filename using
(http://java.sun.com/j2se/1.4.1/docs/api/java/net/URLEncoder.html) with
UTF-8, and set the Content-Disposition according to RFC 2047 as follows:
String encoded_filename = URLEncoder.encode(filename, "UTF-8");
String contentDisp = "=?UTF-8?Q?attachment; filename=" + encoded_filename +
res.setHeader("Content-Disposition", contentDisp);
With this approach, if the Japanese filename is short, when you save the
file from the browser, everything looks fine. If you open it without saving
it, Notepad gets the encoded name (bad). Another problem is that this
approach can only handle filenames up to about 17 Japanese characters.

I tried using other standards (RFC 2184, RFC 2231) with no success.

It wasn't available to me in Tomcat, but this looked like it might have some

I hope you find a solution. If you do, please share it!

Steve Billings
Global 360
Software Internationalization & Localization
Office: 978-266-1604
Cell:    978-697-8201

-----Original Message-----
From: www-international-request@w3.org
[mailto:www-international-request@w3.org]On Behalf Of souravm (by way of
Martin Duerst <duerst@w3.org>)
Sent: Tuesday, October 28, 2003 9:30 PM
To: www-international@w3.org
Subject: Problem in downloading a pdf file having Japanese characters in the
name of the file

Hi All,

I've a pdf file available in a solaris file server. The name of the file
contains Japanese characters.

I'm trying to download this file using a Servlet. For that purpose I'm
setting -

res.setHeader("Content-disposition", "inline; filename=" + fileName);

This filename is a Unicode string contaiing some Japanese characters.

The download is not happening in this case. However, if the filename
contains English Characters it works fine.

Could anyone please let me know what is the problem and the solution for
it ?

Thanks in advance.

Received on Thursday, 30 October 2003 12:26:08 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:40:48 UTC