Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File name in Unicode while downloading

 
Shamu Somasundaram
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic