Jump to content

special characters in URL


gdfhghjdfghgfhf

Recommended Posts

I have a FTP shared with friends where we upload underground music albums and then we use the links to share the downloads in a music forum. Problem is that the album names are in french so there is a lot of special characters in the name

So the URL looks like *http://www.mydomain.com/downloads/Some Band - En français avec des caractères spéciaux (2013) [7'' EP].zip*

For me it works perfectly and i can download the file by using this URL but i have read everywhere that special chars are bad in URL.
Is there any reason why i MUST remove the special characters or encode the URL ?
Is everyone able to access an URL with special characters or some older browsers won't be able to download the file ?

I really don't care about SEO or anything else. I just want the download links to work for everyone.

Since the files are uploaded through FTP i can't use PHP to remove the special chars with regex so i really don't know what to do.

Link to comment
Share on other sites

You generally don't need to because browsers will do it for you, but that's only because websites don't always do it themselves. So you should try to.

 

$file = "Some Band - En français avec des caractères spéciaux (2013) [7'' EP].zip";
echo "<a href='http://www.mydomain.com/downloads/" . htmlentities(urlencode($file)) . "'>Download</a>";
urlencode() because you're putting something into a URL, then htmlentities() because you're putting that into HTML.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.