How can i set localized filenames in java.Currently everytime i click on a localized file having a non-ascii filename in my application, the windows save dialog box pops out, bu
What gustafc says is correct, but it doesn't get you where you want to be. RFC 2231 allows you to use an alternative format for non-ASCII Content-Type
and Content-Disposition
parameters, but not all browsers support it. The way that's most likely to work, unfortunately, is to ignore what RFC 2183 says and use RFC 2047 encoded-words in the response:
response.addHeader("Content-Disposition", "attachment; " +
"filename=\"" + MimeUtility.encodeWord(fileName, "utf-8", "Q") + "\"");
Note that this may not work for all browsers. Some variants of IE require that you URL-encode the value instead:
response.addHeader("Content-Disposition",
"attachment; filename=" + URLEncoder.encode(filename, "utf-8"));