File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Java in General
Bookmark "Finnish/Swedish characters in the FileName" Watch "Finnish/Swedish characters in the FileName" New topic

Finnish/Swedish characters in the FileName

Shoaib Mohammed

Joined: Feb 25, 2010
Posts: 2

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.

Ulf Dittmer

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

Ping & DNS - updated with new look and Ping home screen widget
Shoaib Mohammed

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

Joined: Oct 27, 2005
Posts: 19543

Define "junk characters". Are you sure that your characters or not simply URL encoded? You can use and to encode / decode Strings for use in URLs.

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