Question:
illegal characters in url?
2007-09-07 04:39:35 UTC
I'm trying to let a user specify a comma-separated list of urls to my php function, but commas are a valid url character. How do I delimit the different chunks of urls? Are there any characters that are invalid that I could use instead like > or {?

The key is the character (or set of characters) must be something that you'd never see in an actual url.
Four answers:
ForbiddenPC
2007-09-07 04:48:36 UTC
Not sure if this would work, but the most obvious character that comes to my mind is the space. Its not a valid url character and its a natural separator.



I don't know anything about php, so if I'm way out in left field here, thats why, LOL.
SadButTrue
2007-09-07 05:06:59 UTC
With the exception of the domain you can have pretty much what you want in a Url, especially in the ?SearchQuery string.



You probably need to select a character that has to be escaped out (%xx). That could be the answer, use a % sign on its own which is normally followed by two hexadecimal digits.



The backslash character (\) may be a good candidate as the browser seems to convert it to a forwardslash (/).





_
Don M
2007-09-07 04:49:54 UTC
I hate to break you the bad news but commas are not allowed in a URL Period.

If you intend to to a list of urls it must be done like this.

http://www.google.com

http://www.yahoo.com

Don
fjpoblam
2007-09-07 08:32:21 UTC
Semicolon is traditional


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...