Filenames mangled on upload

I’m having problems with filenames being mangled when uploaded -
usually truncated either upto or after some problematic character.
Here’s an example:

Filename in filesystem: s+o~1@#%^&()_-=[]{};:’".txt
uploadedfile#original_filename: s+o~1@#%^&

Is this a rails/cgi.rb issue or a browser one? I note that gmail’s
“attach file” truncates the filename too, but it does it at the ’
whereas rails does it at the ; . So I’m guessing it’s a serverside
rather than a browser problem, but I have no idea how to deal with it
since by the time my code gets it it’s already been mangled.