Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it ok to have brackets or parenthesis in URL?

Tags:

html

php

Im generating URLs for my AdWord campaigns and some campangin names have brackets in them ( ) and [ ] brackets. And a sample url looks likes this

http://www.website.com/?utm_source=google%5BB%2B%5D&utm_medium=cpc&utm_content=google_ad(B)&utm_campaign=product

Is this fine?

like image 520
nasty Avatar asked Nov 05 '12 01:11

nasty


People also ask

Can you use brackets in domain name?

Braces or curly brackets { } are used when the domain or range consists of discrete numbers and not an interval of values. If the domain or range of a function is all numbers, the notation includes negative and positive infinity . If the domain is all positive numbers plus 0, the domain would be written as .

What do parentheses () and brackets [] In differ?

3. Brackets are used to enclose parenthetical materials within the parentheses while parentheses are used to enclose words, numbers, phrases, sentences, symbols, and other items in a sentence.

What do curly braces mean in URL?

URI path templates are URIs with variables embedded within the URI syntax. These variables are substituted at runtime in order for a resource to respond to a request based on the substituted URI. Variables are denoted by curly braces. For example, look at the following @Path annotation: @Path("/users/{username}")


1 Answers

Parentheses “()” may be used as such in the query part of URL (i.e., the part after “?”). It is allowable, but not necessary, to %-encode them, as “%28” and “%29”.

Brackets “[]” shall be %-encoded, as “%5B” and “%5D”, in the query part.

The sample URL, which is a real URL as www.website.com actually exists (please use www.example.com as a dummy domain name, it is guaranteed to not exist), is thus correctly formed.

The general rules for URL syntax are defined in Internet-standard STD 66, which is currently RFC 3986. Its Appendix A specifies the rules for characters, listing parentheses as belonging to the “sub-delims” group which is allowed without %-encoding in the query part but the brackets as belonging to “gen-delims” which shall be %-encoded.

like image 107
Jukka K. Korpela Avatar answered Oct 05 '22 13:10

Jukka K. Korpela