Can i use '|' in the url?

I am a little confused by this. I noticed that some web APIs use the | (for example, mediawiki api - see "Action = opensearch", the namespace parameter says that you separate the elements with | ).

However, I also see that it is strictly forbidden according to w3 URL spec and this SO question .

So, I misunderstood the examples (e.g. mediawiki) that I saw? Is the browsers url encoded for me behind the scenes? This works with some web browsers and servers, but will break in others?

Since I am creating a web API scheme that the code will access without browsing the browser, I would like to understand this correctly. It would be nice to use | for some terms, but I use a URL encoded trick if it seems too dodgy.

+4
source share
1 answer

No | is not a valid character in the URI and must be encoded using percent encoding .

But beyond that, browsers can display an octet with a percentage of %7C as | , just as percentage encoded character sequences of UTF-8 are displayed as the characters they represent.

+1
source

All Articles