File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Download file with special characters in the file name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Download file with special characters in the file name" Watch "Download file with special characters in the file name" New topic
Author

Download file with special characters in the file name

Ray Clark
Ranch Hand

Joined: Aug 16, 2012
Posts: 55
My file download works good, except when certain characters are in the file name.

When I have the following characters in the file name Firefox replaces the characters with an underscore. Does anyone know why???

The characters that don't work are: * < > | / : ; ? \ "

So my file name is ExportTest*Asterisk and Firefox changes it to ExportTest_Asterisk

(I'm sorry if this should have been posted in another forum, I wasn't sure which one to pic for this question.)

Here is my code snippet:
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18992
    
    8

I would guess that's because those characters aren't allowed in real file names in most file systems.
Ray Clark
Ranch Hand

Joined: Aug 16, 2012
Posts: 55
Thank you, I knew that some of these weren't allowed in UNIX (I haven't used UNIX to create files in a few years). I didn't realize that Windows doesn't allow these either.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61769
    
  67

OS X allows all but the slash and colon, but it's best to stick to normal characters that all platforms support.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ray Clark
Ranch Hand

Joined: Aug 16, 2012
Posts: 55
Thank you Bear. BTW, I really like the redesign of the forum that you have in Beta.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Download file with special characters in the file name