Link to home
Start Free TrialLog in
Avatar of Achilles25
Achilles25

asked on

MAC %20 Problem

This is a web based application.  The application is for a company who receives uploaded documents from clients, via http from Netscape or Internet Explorer.  The uploaded document is uploaded and the document name is placed in the Database.  When the client Operating System is a Macintosh the following occurs:  If there are spaces in the filename the spaces are then changed into %20 so:
FileName:  Hello There
Changed to:  Hello%20There
i need to know what the problem is and how to fix it.
Avatar of ipierce
ipierce

well that's certainly something you see a lot on the web.  the %20 refers to ASCII character number 20, which is a space.   Other nonstandard characters (i.e. not seen in URLs) like ! get a %22 or something like that.  Not that I know the fix, but maybe this will help.

also, please clarify a bit what is happening:  the mac client is uploading a file thru netscape or IE, on the mac it's called "hello there" but when it gets to the other end you see "hello%20there" as the file that just got uploaded to the server?  Is that accutare?
The solution is to run the file name through a "URL decode/escape" function.  You just need to account for this on the server application.  On Windows, all spaces in file names are internally translated to the "+" character, when the file is selected.  On the Mac, the spaces are translated to "%20".  All character are translated *again* when the form is submitted; the "+" character does not get escaped, but "%20" becomes "%2520" (25 is the hex code for the '%' character)!  This probrably should be classified as a bug.

An alternative is to write a JavaScript routine to obtain and encode the file name in the same manner across OS's.
ASKER CERTIFIED SOLUTION
Avatar of TheHub
TheHub

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
the problem occurs most often when the file is uploaded to an http server and not the correct ftp server. people do this if there is no ftp server available.
The fix is simple: just use an _ (underscore) in place of a space
The fix is simple: just use an _ (underscore) in place of a space