Which special characters are safe to use in url?
|
|
The safe characters are a-z, A-Z, 0-9, and _ - (underscore and minus), that besides the reserved characters who are used for the parameters. Other characters will give problems in some degree. example: if one parameter is an array But the problem is not only it's ugly, lets say you have a jpg with a character beside the safer ones, many times the browser will be unable to download it getting a 404. This is a problem of older browsers and some mobile browsers. How to test this?
I have an inbox with 14000 emails proving my point. |
|||||||
|
|
The following characters have special meaning in the path component of your URL (the path component is everything before the '?'):
In addition to those, the following characters have special meaning in the query part of your URL (everything after '?'). Therefore, if they are after the '?' you need to escape them:
For a more in-depth explanation, see the RFC. |
||||
|
|
The answers here are good, but there is one more exception I think is worth mentioning - non-english characters. Referencing this SF question here, characters like ñ (as in Español) are perfectly legitimate, IF they have been encoded in your DNS correctly. You have to use Punycode within your DNS to get them to resolve in modern browsers (the entry for español is |
|||
|
|