QR Code
The following is a summary of the commonly found data types that are used within QR Codes to structure the data:
URL
The URL type simply allows for a URL to be encoded, the intention being that the QR Code scanner will automatically redirect the user to the URL where further information is available.
Automatic redirection is performed less these days as this opens the door to abuse whereby users are unwittingly redirected to an undesirable URL. As such, most scanners either prompt the user for redirection or allow for automatic redirection to be disabled in the application settings.
The following is an example of the raw encoding:
http://www.mistersudoku.com
Text
The following is an example of the raw encoding:
Mister Sudoku
Phone Number
The Phone Number type allows for phone numbers to be encoded, the intention being that the QR Code scanner will either populate the number in the dialer or actually dial the number for the user.
Automatic dialing is less common these days due to the risk of abuse, as a malicious XR Code could easily result in a premium rate or international number being dialed.
The following is an example of the raw encoding:
TEL:+123456789
SMS
The following is an example of the raw encoding:
SMSTO:+123456789:The quick brown fox jumps over the lazy dog
Bookmark
The Bookmark type allows for a Title to be included in addition to the URL.
This is one of the ‘de facto’ standard types that was introduced by NTT Docomo, full details of the type can be found on their website (here).
One point to note is that the URL needs to be escaped. The common approach that seems to be used is to escape the colon (‘:’) by preceding it with a backslash (‘\’).
The following is an example of the raw encoding:
MEBKM:
TITLE:Mister Sudoku;
URL:http\://www.mistersudoku.com;
;
Line breaks are included for readability, but shouldn’t be included in actual encodings.
Geo
The following is an example of the raw encoding:
geo:27.988257,86.925145,8749
Contact Details (meCard)
The meCard type allows for Contact Details to be encoded as a QR Code.
This is one of the ‘de facto’ standard types that was introduced by NTT Docomo, full details of the type can be found on their website (here).
Individual fields can be repeated if required. An example of this would be including the Telephone number (TEL) field multiple times to represent multiple numbers (i.e. Mobile / Landline)
The following is an example of the raw encoding:
MECARD:
N:Doe,John;
TEL:123456789;
EMAIL:john.doe@email.com;
BDAY:19650401;
ADR:,,,,,,Singapore;
;
Line breaks are included for readability, but shouldn’t be included in actual encodings.