Template:URL encode

From Library
Jump to navigation Jump to search

Template source

Notes

Template:See also Template:URL encode

Variations using built-in Parser functions:

  • URL/URL encode: {{urlencode:{{{1|}}}}}
  • URL query/URL parameter: {{urlencode:{{{1|}}}|QUERY}}
  • URL wiki title: {{urlencode:{{{1|}}}|WIKI}}
  • URL path: {{urlencode:{{{1|}}}|PATH}}
  • URL anchor: {{anchorencode:{{{1|}}}}}

Example usage (live)

Basic URL (this template)
https://web.archive.org/web/www.google.com
Complex URL:
Complex URL: https%3A%2F%2Fusername%3Apassword%40www.example.com%2Fpath%2Fto%2Fpagename.html%3Fq%3Dquerytext%26s%3Dotherparametertext%23fragmentid
Query parameter
https://google.com/search?q=MediaWiki+template+design
Complex URL: https%3A%2F%2Fusername%3Apassword%40www.example.com%2Fpath%2Fto%2Fpagename.html%3Fq%3Dquerytext%26s%3Dotherparametertext%23fragmentid
MediaWiki page title
https://en.wikipedia.com/wiki/Apple_Computer
Complex URL: https://username:password@www.example.com/path/to/pagename.html%3Fq%3Dquerytext%26s%3Dotherparametertext%23fragmentid
URL path
http://example.com/path%2Fto%20a%2Ffolder
Complex URL: https%3A%2F%2Fusername%3Apassword%40www.example.com%2Fpath%2Fto%2Fpagename.html%3Fq%3Dquerytext%26s%3Dotherparametertext%23fragmentid
Anchor
https://en.wikipedia.com/wiki/Ladder#Safety_issues
Complex URL: https:.2F.2Fusername:password.40www.example.com.2Fpath.2Fto.2Fpagename.html.3Fq.3Dquerytext.26s.3Dotherparametertext.23fragmentid
Raw ‘Complex URL’ as used above
Complex URL: https://username:password@www.example.com/path/to/pagename.html?q=querytext&s=otherparametertext#fragmentid

Variations

via equivalent parser functions
A: https://web.archive.org/web/www.google.com
https://web.archive.org/web/www.google.com
B: https://google.com/search?q=MediaWiki+template+design
https://google.com/search?q=MediaWiki+template+design
C: https://en.wikipedia.com/wiki/Apple_Computer
https://en.wikipedia.com/wiki/Apple_Computer
D: http://example.com/path%2Fto%20a%2Ffolder
http://example.com/path%2Fto%20a%2Ffolder
E: https://en.wikipedia.com/wiki/Ladder#Safety_issues
https://en.wikipedia.com/wiki/Ladder#Safety_issues
https%3A%2F%2Fusername%3Apassword%40www.example.com%2Fpath%2Fto%2Fpagename.html%3Fq%3Dquerytext%26s%3Dotherparametertext%23fragmentid
Complex URL
A: https%3A%2F%2Fusername%3Apassword%40www.example.com%2Fpath%2Fto%2Fpagename.html%3Fq%3Dquerytext%26s%3Dotherparametertext%23fragmentid
https%3A%2F%2Fusername%3Apassword%40www.example.com%2Fpath%2Fto%2Fpagename.html%3Fq%3Dquerytext%26s%3Dotherparametertext%23fragmentid
B: https%3A%2F%2Fusername%3Apassword%40www.example.com%2Fpath%2Fto%2Fpagename.html%3Fq%3Dquerytext%26s%3Dotherparametertext%23fragmentid
https%3A%2F%2Fusername%3Apassword%40www.example.com%2Fpath%2Fto%2Fpagename.html%3Fq%3Dquerytext%26s%3Dotherparametertext%23fragmentid
C: https://username:password@www.example.com/path/to/pagename.html%3Fq%3Dquerytext%26s%3Dotherparametertext%23fragmentid
https://username:password@www.example.com/path/to/pagename.html%3Fq%3Dquerytext%26s%3Dotherparametertext%23fragmentid
D: https%3A%2F%2Fusername%3Apassword%40www.example.com%2Fpath%2Fto%2Fpagename.html%3Fq%3Dquerytext%26s%3Dotherparametertext%23fragmentid
https%3A%2F%2Fusername%3Apassword%40www.example.com%2Fpath%2Fto%2Fpagename.html%3Fq%3Dquerytext%26s%3Dotherparametertext%23fragmentid
E: https:.2F.2Fusername:password.40www.example.com.2Fpath.2Fto.2Fpagename.html.3Fq.3Dquerytext.26s.3Dotherparametertext.23fragmentid
https:.2F.2Fusername:password.40www.example.com.2Fpath.2Fto.2Fpagename.html.3Fq.3Dquerytext.26s.3Dotherparametertext.23fragmentid
ASCII (w/o letters, numbers, or ‘|’)
A: %21%22%23%24%25%26%5C%27%28%29%2A%2B%2C-.%2F%3A%3B%3C%3D%3E%3F%40%5B%5C%5C%5D%5E_%60%7B%7D%7E
%21%22%23%24%25%26%5C%27%28%29%2A%2B%2C-.%2F%3A%3B%3C%3D%3E%3F%40%5B%5C%5C%5D%5E_%60%7B%7D%7E
B: %21%22%23%24%25%26%5C%27%28%29%2A%2B%2C-.%2F%3A%3B%3C%3D%3E%3F%40%5B%5C%5C%5D%5E_%60%7B%7D%7E
%21%22%23%24%25%26%5C%27%28%29%2A%2B%2C-.%2F%3A%3B%3C%3D%3E%3F%40%5B%5C%5C%5D%5E_%60%7B%7D%7E
C: !%22%23$%25%26%5C%27()*%2B,-./:;%3C%3D%3E%3F@%5B%5C%5C%5D%5E_%60%7B%7D~
!%22%23$%25%26%5C%27()*%2B,-./:;%3C%3D%3E%3F@%5B%5C%5C%5D%5E_%60%7B%7D~
D: %21%22%23%24%25%26%5C%27%28%29%2A%2B%2C-.%2F%3A%3B%3C%3D%3E%3F%40%5B%5C%5C%5D%5E_%60%7B%7D~
%21%22%23%24%25%26%5C%27%28%29%2A%2B%2C-.%2F%3A%3B%3C%3D%3E%3F%40%5B%5C%5C%5D%5E_%60%7B%7D~
E: .21.22.23.24.25.26.5C.27.28.29.2A.2B.2C-..2F:.3B.3F.40.5B.5C.5C.5D.5E_.60.7B.7D.7E
.21.22.23.24.25.26.5C.27.28.29.2A.2B.2C-..2F:.3B.3F.40.5B.5C.5C.5D.5E_.60.7B.7D.7E
Raw: “ !"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~”
Raw: “ !"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~” nowiki
Raw: “
 !"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~
pre
Raw: “<pre> !"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~</pre>” nowiki+pre
Raw: “
 !"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~
pre+nowiki
Raw: “ !"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~code

Comparison table

Note: create the following templates to enable this section…

Template:Encoding table/et

| %7B%7B%7B1%7D%7D%7D

| %7B%7B%7B1%7D%7D%7D | %7B%7B%7B1%7D%7D%7D | %7B%7B%7B1%7D%7D%7D | .7B.7B.7B1.7D.7D.7D | {{{1}}} | {{{1}}} | <sample>{{{1}}}</sample> | {{{1}}}


Template:Encoding table header/eth

| URL | Query | Wiki | Path | Anchor | Code | Kbd | Sample | Nowiki

Template:Encoding table footer/etf

(tbd)

Other / notes

Note: the ‘All ASCII’ sets do not include the ‘pipe’ character “|”

All ASCII : %7D%7E%27
A: %21%22%23%24%25%26%5C%27%28%29%2A%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7D%7E+%7C
B:
Some letters : ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz%C3%80%C3%81%C3%82%C3%83%C3%84%C3%85%C3%86%C3%87%C3%88%C3%89%C3%8A%C3%8B%C3%8C%C3%8D%C3%8E%C3%8F%C3%90%C3%91%C3%92%C3%93%C3%94%C3%95%C3%96%C3%98%C3%99%C3%9A%C3%9B%C3%9C%C3%9D%C3%9E%C3%9F%C3%A0%C3%A1%C3%A2%C3%A3%C3%A4%C3%A5%C3%A6%C3%A7%C3%A8%C3%A9%C3%AA%C3%AB%C3%AC%C3%AD%C3%AE%C3%AF%C3%B0
ASCII (w/o letters, numbers, or ‘|’): %21%22%23%24%25%26%5C%27%28%29%2A%2B%2C-.%2F%3A%3B%3C%3D%3E%3F%40%5B%5C%5C%5D%5E_%60%7B