Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem setting Unicode (utf-8) in http header using tomcat

843841Oct 16 2007 — edited Oct 17 2007
Hi:

I am trying to set a file name in utf-8 to http header using the following code:

response.setContentType("text/html; charset=utf-8");
response.setHeader("Content-disposition", "attachment; filename=解決.zip");
// I actually has file name in utf-8 here to set to the header, and I know that the name is correctly
// and I also looked into the response object MimeHeaders object and saw the head is correctly there

then write the content of zip file using ServletOutputStream.

The problem I have is that the file name is not displayed correctly when prompted to save or open in the pop up window next. I found out using Fiddler that the request header is wrong:

Content-disposition: attachment; filename=�zn��.zip


I am using Tomcat 5.0.28. Any idea how to get this working?

Thanks in advance!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 14 2007
Added on Oct 16 2007
2 comments
760 views