My favorites | Sign in
Google
                
Search
for
Updated Sep 23, 2009 by sro...@gmail.com
Labels: Featured
BarcodeContents  
A rough guide to standard encoding of information in barcodes

Barcode Contents

Much has been said about 2D barcodes, and the discussion has focused on the format of the 2D barcode itself -- QR Code, Data Matrix, and so on. But equally important is the format of what the barcode itself encodes.

2D barcodes encode text, generally, but that text can represent many things. Commonly, 2D barcodes encode text that represents a URL, like "http://google.com/m". This is a special string of text since it is recognizable as a URL by readers, and therefore can be acted upon: the reader can open the URL in a browser.

2D barcodes can encode many types of actionable text. Text representing contact information, when recognized, could trigger a prompt to add the contact to an address book. But this only works when readers understand that text encodes contact information. For this, we need standards too.

There are some standards -- de facto and otherwise -- already in use. This wiki attempts to catalog some possible standards for encoding various types of information, and suggest a standard action associated to them. It is not necessarily complete and contributions are welcome.

The ZXing reader library supports all of the formats mentioned in this wiki and a bit more.

URL

The most common application of barcodes is to encode the text of URL such as http://google.com/m. To do so, simply encode exactly the text of the URL in the barcode: "http://google.com/m". Include the protocol ("http://", here) to ensure it is recognized as a URL.

Readers should open the URL in the device's web browser when decoding a URL. It is probably desirable for a reader to display the URL and ask the user whether to proceed, so that the user may see the URL before accessing it.

URLs prefixed with "URLTO:" have been observed "in the wild" (e.g. "URLTO:google.com/m"). TODO: get more information on this syntax.

Note that NTT DoCoMo uses a "MEBKM" bookmark format to express not only a URL but title. This could be treated like a URL, or, prompt the user to add a browser bookmark.

E-mail address

To encode an e-mail address like sean@example.com, one could simply encode "sean@example.com". However to ensure it is recognized as an e-mail address, it is advisable to create a proper mailto URI from the address: "mailto:sean@example.com".

Readers should open a blank e-mail message to the given address.

Note that NTT DoCoMo has standardized a more expressive "MATMSG" format for encoding an e-mail address, subject, and message.

Telephone numbers

A tel URI should be used to encode a telephone number, to ensure that the digits are understood as a telephone number. Further, it is advisable to include prefixes that make the number accessible internationally. For example, to encode the US phone number 212-555-1212, one should encode "tel:+12125551212". This tel URI includes a "+1" prefix that will make it usable outside the United States.

Readers should invoke the device's dialer, if applicable, and pre-fill it with the given number, but not automatically initiate a call.

Contact information

We have, for example, the vCard format for encoding contact information as text. This format proves a bit verbose for use in 2D barcodes, whose information capacity is limited. It is not clear whether vCard is or should be used to encode contact information.

NTT DoCoMo has popularized a compact "MECARD" format for encoding contact information. For example, to encode the name Sean Owen, address "76 9th Avenue, 4th Floor, New York, NY 10011", phone number "212 555 1212", e-mail "srowen@example.com", one would encode this in a barcode:

MECARD:N:Owen,Sean;ADR:76 9th Avenue, 4th Floor, New York, NY 10011;TEL:+12125551212;EMAIL:srowen@example.com;;

See the link above for complete information. Note that this format has generally been used with QR Codes only in the past, but, may well be parsed and understood when encoded in a DataMatrix symbol too.

Readers should open a new address book entry, populated with the given data, and prompt the user to add a new contact.

AU format

Note that KDDI AU also proposes a slightly different format for this information.

BIZCARD

We have also observed a "BIZCARD" format in use but have yet to locate a definitive reference on the format. One can guess its structure from a few examples; it resembles the MECARD format:

BIZCARD:N:Sean;X:Owen;T:Software Engineer;C:Google;A:76 9th Avenue, New York, NY 10011;B:+12125551212;E:srowen@google.com;;

vCard

vCard format has been used as well to encode contact information, though it is more verbose.

SMS

Much like an e-mail address, one can encode an SMS shortcode or number by creating an sms URI. For example to create a link to the number "12345" one would encode "sms:12345". See this draft of the SMS URI specification for details.

Likewise "SMSTO:" URLs have been observed in the wild, though I am still looking for an official specification for it. Follow this with the number to SMS.

We have heard of URIs of the form "sms:number:subject", and likewise for other prefixes like "smsto:".

Readers should open a new SMS message, ready for the user to compose and send it.

MMS

Likewise, there appear to be "mms:" and "MMSTO:" URIs used like "sms:" URIs in practice. We assume the format is the same, and that the reader should react similarly to such a URI.

Geographic information

A geo URI may be used to encode a point on the earth, including altitude. For example, to encode the Google's New York office, which is at 40.71872 deg N latitude, 73.98905 deg W longitude, at a point 100 meters above the office, one would encode "geo:40.71872,-73.98905,100".

A reader might open a local mapping application like Google Maps to this location and zoom accordingly, or could open a link to this location on a mapping web site like Google Maps in the device's web browser.

Platform-specific

Android Market

Charles notes you can construct URIs that (on Android devices) link directly into the Android Market. For example to encode a link to all apps developed by Charles:

market://search?q=pub:"Charles Chen"

In a barcode this needs to be encoded according to URI rules:

market://search?q=pub%3A%22Charles%20Chen%22

Likewise one can encode a link to a particular application by referencing its package, it seems:

market://search?q=pname:com.google.zxing.client.android

... encoded as:

market://search?q=pname%3Acom.google.zxing.client.android

Unconfirmed, Unreleased, Possibilities

YouTube URI

This is rumored to work on the iPhone at least, triggering the native YouTube player: "youtube://ID"

iCal

Though not observed in any QR Code or reader so far, it is conceivable that iCal format could be used to encode calendar events. Readers could add events to the user's calendar in response.

We tentatively suggest using an abbreviated form that omits the VCALENDAR element:

BEGIN:VEVENT
SUMMARY:Test Meeting
DTSTART:20080811T190000Z
DTEND:20080811T200000Z
END:VEVENT

... without the BEGIN:VCALENDAR / END:VCALENDAR start/end elements.

Chat status and presence

Simon suggests a new URI syntax to communicate chat status updates, and to follow, for instance, a user in a service like Twitter:

pa:status:Enjoying a cup of coffee
pa:add:alice
pa:add:sip:alice@example.org

Other Standards and References


Comment by leybzon, Jul 23, 2008

Correction for iPhone YouTube? URL - it should be youtube://id

Comment by david.spathaky, Oct 05, 2008

MobileTag? site actually says at the moment 10/08 that they convert information into vCard format. So this looks like just an 2d encoding service or a two stage 2d code to to vcard online service. (I could be wrong)!

Best regards Dave @ http://geohash.org/gc0vg2x6uw5t

Comment by kmccurley, Oct 14, 2008

note that some people try to put additional fields such as subject and body into a mailto URL, but that has very spotty client support. RFC 2368 apparently never got much acceptance.

Comment by mendodude, Jan 01, 2009

I am looking in to adding a QR code to my card using the MECARD format but I need some guidance as far as the QR code!

Does the QR code need to be a standard size or can I simply fit it to the business card? Is there a standard size for QR codes on business cards?

Thanks.

My QR code and plaintext MECARD: http://docs.google.com/Doc?id=ddp5t4qk_48834srhg8

Comment by sro...@gmail.com, Jan 02, 2009

To increase chances of decoding properly, you should print the code as large as possible. At Google we simply printed on the back side of the card, as large as practical (remember to leave a 4-module white area, or quite zone, around the code). Your code looks fine.

Comment by si...@mungewell.org, Jan 23, 2009

One 'encoding' that you could also consider is MIL-STD-130 use by the US miltary (and NATO).

MIL-STD-130 is a mandatory marking scheme required on all items purchased by the milatary of a value larger than $1000. It's intend is to uniquely identify assets, both for stock/asset control and tracability to initial manufacturers.

This can be via individual 1D Code-38 barcodes, and/or 2D Datamatrix containing multiple records.

See: http://www.acq.osd.mil/dpap/UID/attachments/mil-std-130m-20051202.pdf

PDF contains lots of examples.

For the Datamatrix they have a 'record start', 'record-seperator' and 'record-end' concept to split the data items. Data items are prefix with ASCII indicator of what they represent.

Comment by eric.seuret, Apr 01, 2009

I could find no reader that open a new address book entry when you scan a QR code with vCard or MECARD... What reader do you use ?

Comment by sro...@gmail.com, Apr 01, 2009

Well at least this project's client for Android (Barcode Scanner) does!

Comment by heramb22, Jun 03, 2009

i-Nigma opens the address book entry on Windows Mobile 6

Comment by neurobox, Jul 20, 2009

Needed: Platform standard for Augmented Reality content.

Anyone should be able to point a cameraphone at any recognizable, lets say, 'QR3D' tag, and superimpose 3d content from a common format, hosted anywhere on the web, using open AR engine platforms (ala FLARtoolkit and the likes), and common open 3d content standards.

No need to let the facial ID companies have all the fun.

This could also be a powerful promotional tool, as was this proprietary effort: http://ge.ecomagination.com/smartgrid/

Comment by mike.pearson.nz, Aug 30, 2009

How about an encoding standard for simple e-commerce documents e.g. invoice, receipt, purchase order. This could increase productivy and automation for many transactions e.g. scanning a receipt to do an expense claim.

Comment by LauraBErickson, Sep 02, 2009

Good Morning~ I have the BB Storm and have tried many times to download a reader for the 2D QR Codes. I have tried BeeTagg? more than once, can anyone help guide me to a reader that works on BlackBerry?? Thank you. Laura Erickson

Comment by t...@thenewaddress.com, Sep 11, 2009

Laura, BeeTagg? is slowly catching on in the US. The Storm as with all BB phones is behind in developing an app. for it. Personally, I find the BeeTagg? design the most appealing, but most limited in reader capacity.

Comment by frabuck, Oct 08, 2009

I, too, would like to see the AR capability added here.

Comment by aaron.r.coats, Oct 21, 2009

Question: What happens if you include more than one type of content in a QRCode? For instance I might want to contain a URL to a page containg a google static map and a geo: tag. It would be good it it let people choose to either open in a browser or map application. (I'd check this myself, but I'm still waiting for my android phone to arrive).

Comment by sro...@gmail.com, Oct 21, 2009

Please ask questions at the discussion group: http://groups.google.com/group/zxing/

It probably won't work. I don't think it's common enough to include several types of info to bother supporting this. QR Code contents are short, and so are going to be one thing -- a URL, contact info, geo: URL, etc.


Sign in to add a comment