This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General 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