URL-Encoded folders and files

Ken Elliott's picture

They have: 358 posts

Joined: Jun 1999

Been creating CMS systems lately and I've been doing some regex to remove all special characters when a user tries to create a new folder or file. Question is, would there be harm in URL-Encoding the name and then using that to name the file? Like if they try to create a new file...

they enter: new stuff!
I then encode it to: new_stuff%21

and use that for the filename. Then I can read it back in, decode it, and display it as it was meant to be shown.

Thanks for any info.
webg

Pimpin like a pimp with an electrofied pimpin machine!

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

I don't think % is a special character in any file systems. I see no other reason why it wouldn't work.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.