/ informatics / datastructures /

[edit]

URI URL URN

Definition

A Uniform Resource Identifier (URI) is a string of characters used to identify a resource. Web-URLs, for example, are a common type of URIs.

Table of Contents

Syntax

scheme:[//[user[:password]@]host[:port]][/path][?query][#fragment]

Example

         user    host    port
         ┌┴─┐ ┌───┴───┐  ┌┴┐ 
 https://john@github.com:123/repo/master/?color=true&mode=raw#L123
 └─┬─┘ └───────┬───────────┘└───┬───────┘└──────────┬───────┘└─┬─┘  
 scheme     authority          path               query      fragment

URI Parser

Escape Characters

⇦ enc/dec ⇨

The characters allowed in a URI are either reserved, unreserved or percent-encoded (e.g. %3F for a ?).

Char Escape Char Escape Char Escape
space %20 , %2C ^ %5E
! %21 / %2F _ %5F
" %22 : %3A { %7B
# %23 ; %3B | %7C
$ %24 < %3C } %7D
% %25 = %3D ~ %7E
& %26 > %3E
' %27 ? %3F ä %C3%A4
( %28 @ %40 ö %C3%B6
) %29 [ %5B ü %C3%BC
* %2A \ %5C ÷ %C3%B7
+ %2B ] %5D ø %C3%B8

Relationship to URN and URL

URN and URL are types of URIs. A Uniform Resource Name (URN) can be compared to a person's name, while a Uniform Resource Locator (URL) can be compared to their street address. In other words, a URN identifies an item and a URL provides a method for finding it.

Example URNs:

References

-->