Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Valid characters for URI schemes?

I was thinking about Registering an Application to a URL Protocol and I'd like to know, what characters are allowed in a scheme?

Some examples:

  • h323 (has numbers)
    • h323:[<user>@]<host>[:<port>][;<parameters>]
  • z39.50r (has a . as well)
    • z39.50r://<host>[:<port>]/<database>?<docid>[;esn=<elementset>][;rs=<recordsyntax>]
  • paparazzi:http (has a :)
    • paparazzi:http:[//<host>[:[<port>][<transport>]]/

So, what characters can I fancy using?
Can we have...

  • @:TwitterUser
  • #:HashTag
  • $:CapitalStock
  • ?:ID-10T

...etc., as desired, or characters in the scheme are restricted by standard?

like image 911
Camilo Martin Avatar asked Sep 04 '10 09:09

Camilo Martin


People also ask

What characters are valid in a URL?

A URL is composed from a limited set of characters belonging to the US-ASCII character set. These characters include digits (0-9), letters(A-Z, a-z), and a few special characters ( "-" , "." , "_" , "~" ).

What is scheme name in URI?

If the URI is telnet://192.0.2.16:80, the scheme name is "telnet."

What is a custom URI?

Overview# Custom URI scheme is URI Scheme (as defined by RFC 3986) that a native application creates and registers with the Operating System (and is NOT a standard URI scheme like "https:" or "tel:").


3 Answers

According to RFC 2396, Appendix A:

  scheme        = alpha *( alpha | digit | "+" | "-" | "." )

Meaning:

The scheme should start with a letter (upper or lower case), and can contains letters (still upper and lower case), number, "+", "-" and ".".


Note: in the case of

paparazzi:http:[//<host>[:[<port>][<transport>]]/

the scheme is only the "paparazzi" part.

like image 108
Vivien Barousse Avatar answered Sep 30 '22 15:09

Vivien Barousse


The scheme according to RFC 3986 is defined as:

scheme      = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )

So the scheme must begin with an alphabetic character (AZ, az) and may be followed by any number of alphanumeric characters, +, -, or ..

like image 36
Gumbo Avatar answered Oct 02 '22 15:10

Gumbo


Quoth RFC 2396:

Scheme names consist of a sequence of characters beginning with a lower case letter and followed by any combination of lower case letters, digits, plus ("+"), period ("."), or hyphen ("-").

like image 37
BoltClock Avatar answered Oct 02 '22 15:10

BoltClock