• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Finnish/Swedish characters in the FileName

 
Shoaib Mohammed
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

My servlet is building a file and the fileName contains special characters like Finnish/Swedish characters: Ä, ä, ö, etc.
While saving this file, in the Browser this filename gets converted to junk characters.

Please help me out with this situation. I want the fileName to be retained in the browser as sent by the Servlet.

Regards,
Shoaib.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you handling encoding of the web page?
 
Shoaib Mohammed
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not forwarding the request to the web page. From servlet itself i am returning the file to the user, which gives the option of saving or opening of the file.
And on saving the file the fileName gets converted to junk characters.

I think if i forward the request to a jsp and then perform URLencoder.encode() on the filename, this might work. But, this is an existing application i can't modify the design.
I need to resolve this in the servlet itself.
 
Rob Spoor
Sheriff
Pie
Posts: 20559
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Define "junk characters". Are you sure that your characters or not simply URL encoded? You can use java.net.URLEncoder and java.net.URLDecoder to encode / decode Strings for use in URLs.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic