aspose file tools*
The moose likes Servlets and the fly likes File name in Unicode while downloading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "File name in Unicode while downloading" Watch "File name in Unicode while downloading" New topic
Author

File name in Unicode while downloading

Shamu Somasundaram
Ranch Hand

Joined: Aug 25, 2004
Posts: 41
Hi,
I want to display the file name in Unicode when I download the file.
In IE it's not displaying properly.

My code goes like this

res.setContentType("application/octet-stream;charset=UTF-8");
fname = new String(fname.getBytes(),"UTF-8");
res.setHeader("Content-Disposition", "attachment; filename=\"" + fname + "\"");

When I run eclipse in debug mode, the filename is displayed properly in Watch expression. But while downloading in IE, in Save As dialog box, the file name appears as junk characters.
Can any of the ranchers help me out?

Thanks in advance.
Shanmugavel
vishwanath nadimpally
Ranch Hand

Joined: Jan 25, 2005
Posts: 116
fname = new String(fname.getBytes(),"UTF-8");

Why do you need this? you can just use the file name as it is.
Shamu Somasundaram
Ranch Hand

Joined: Aug 25, 2004
Posts: 41
Originally posted by vishwanath nadimpally:
fname = new String(fname.getBytes(),"UTF-8");

Why do you need this? you can just use the file name as it is.


no..it didn't work..the name was appearing as junk even then..
can anyone help me out?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File name in Unicode while downloading
 
Similar Threads
Character Encoding
Reading unicode characters from a file
How to read and write the data in XML file
How many bits are there for UTF characters?
ASCII to UNICODE