Search code examples
urlseparator

Valid URL separators


I have a long URL with several values.

Example 1:

http://www.domain.com/list?seach_type[]=0&search_period[]=1&search_min=3000&search_max=21000&search_area=6855%3B7470%3B7700%3B7730%3B7741%3B7742%3B7752%3B7755%3B7760%3B7770%3B7800%3B7840%3B7850%3B7860%3B7870%3B7884%3B7900%3B7950%3B7960%3B7970%3B7980%3B7990%3B8620%3B8643%3B8800%3B8830%3B8831%3B8832%3B8840%3B8850%3B8860%3B8881%3B9620%3B9631%3B9632

My variable search area contains only 4 number digits (example 4000, 5000), but can contain a lot of them. Right now I seperate these in the URL by using ; as separator symbol. Though as seen in Example 1, the ; is converted into %3B. This makes me believe that this is a bad symbol to use.

What is the best URL separator?


Solution

  • Well, according to RFC1738, valid URLs may only contain the letters a-z, the plus sign (+), period and hyphen (-).

    Generally I would go with a plus to separate your search areas. So your URL would become http://www.example.com/list?seach_type=0&search_period=1&search_min=3000&search_max=21000&search_area=6855+7470+7700+...

    --EDIT--

    As GinoA pointed out I misread the document. Hence "$-_.+!*'()," are valid characters too in an unencoded URL. I'd still go with the + sign though.