0

I am working on adding deep linking for my ios app.

My url format is "myapp://search?range={1,3}"

My question is should I support the format which is url encoded? i.e.

myapp://search%3frange%3d%7b1%2c3%7d

or just keep using

myapp://search?range={1,3}

rmaddy
  • 314,917
  • 42
  • 532
  • 579
michael
  • 106,540
  • 116
  • 246
  • 346

2 Answers2

2

The ? mark is a proper symbol to start a query string. Do not encode it.

The = sign is being used to separate a URL query parameter from its value. Do not encode it.

The numbers are perfectly safe unreserved URI characters and do not need to be encoded.

The comma should be encoded since it is a reserved character.

The curly braces, technically, should be encoded since they are not listed as reserved or unreserved characters in RFC 3986.

See the percent-encoding article on Wikipedia for more details.

So you probably want:

myapp://search?range=%7b1%2c3%7d

rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • In my code, I should url decode they query string from "range=%7b1%2c3%7d" to range={1,3}"? Using the url decode example here?http://stackoverflow.com/questions/7920071/how-to-url-decode-in-ios-objective-c – michael Jan 07 '15 at 18:54
  • You should only need to decode the part after the `=` sign. – rmaddy Jan 07 '15 at 18:56
1

If you dont need json at all, use something like myapp://search/range/1/3 and https://github.com/joeldev/JLRoutes.

Thomas Kekeisen
  • 4,355
  • 4
  • 35
  • 54