base64 for passing file names in query strings
Moderator: General Moderators
base64 for passing file names in query strings
Wondering if anyone has used base64 encoding for passing file names back in a query string as opposed to rawurlencode/urlencode? Good idea? Bad idea? Acceptable?
I've had trouble in the past passing file names around with rawurlencode ... Just want to be sure the string is passed regardless of what it might be named. Consider an image named:
My Grandma's house in july, john, alex and !@ #$ steve eating some'o grandma's cake.jpg
It's a bit long but in this case I don't know what files will be named.
My Grandma's house in july, john, alex and !@ #$ steve eating some'o grandma's cake.jpg
It's a bit long but in this case I don't know what files will be named.
I see what you mean, but to my knowledge urlencode() should take care of it -- it encodes all non-alphanumeric characters (except -_.), which includes ... well, all of the special chars. I guess there could be a problem with charsets. For example: unicode uses 1 or more bytes for some characters, and I don't know how urlencode works for those.
So, you're supposed to be safe with urlencode(), but since you say you've had problems, I'm not so sure anymore. Can you reproduce the problems?
As for the base64 method, I don't see anything wrong with it in particular, it's very url-safe and all. If you don't have time to bother and feel comfortable with it, use it.
So, you're supposed to be safe with urlencode(), but since you say you've had problems, I'm not so sure anymore. Can you reproduce the problems?
As for the base64 method, I don't see anything wrong with it in particular, it's very url-safe and all. If you don't have time to bother and feel comfortable with it, use it.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland