wood burning stoves 2.0*
The moose likes Java in General and the fly likes Finnish/Swedish characters in the FileName Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Finnish/Swedish characters in the FileName" Watch "Finnish/Swedish characters in the FileName" New topic
Author

Finnish/Swedish characters in the FileName

Shoaib Mohammed
Greenhorn

Joined: Feb 25, 2010
Posts: 2
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
Marshal

Joined: Mar 22, 2005
Posts: 41155
    
  45
How are you handling encoding of the web page?


Ping & DNS - my free Android networking tools app
Shoaib Mohammed
Greenhorn

Joined: Feb 25, 2010
Posts: 2
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

Joined: Oct 27, 2005
Posts: 19656
    
  18

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
 
subject: Finnish/Swedish characters in the FileName
 
Similar Threads
Swedish characters
How to write single byte and double byte characters on pdf using java api(iText)
CXF and JAXB binding for a class/property with special character in its name?
How to export the chinese character to excel using ExcelCSVPrinter. Open the file within browser
Java : How to accomodate special characters in the filename while uploading and downloading the file