How are different content types within QR-Codes di

2019-09-08 10:13发布

问题:

QR-Codes can contain different contents (URLs, vCards, Wifi-Configurations...) - in the specification of QR-Code seems nothing defined regarding content.

How these different content types are distinguished? Only via parsing the first few characters of the content and matching to URL schemes (http:, tel:, fb:)? Or is there another 'magic' value inside the code?

So it seems impossible to encode multiple contents in ONE QR-Code without gambling with reader-app-compatibility... e.g. one URL and some text in ONE code.

Thanks in advance.

回答1:

How these different content types are distinguished? Only via parsing the first few characters of the content and matching to URL schemes (http:, tel:, fb:)?

Yes. A QR Code just contains a string of UTF-8 characters. It is up to the QR Scanner to interpret the text.

Typically it will look at the first few characters to see if they match a scheme it recognises.

So it seems impossible to encode multiple contents in ONE QR-Code without gambling with reader-app-compatibility... e.g. one URL and some text in ONE code.

That's right. Typically a single QR code contains a single piece of information. If you have a code which is http://example.com/\nVisit Us! then it is likely that some readers will get confused.

The best thing you can do it create a URL which points to a web page containing the different types of data. For example, my QR codes point to http://edent.tel/ the website then has mailto:, http://, VCARD, tel: etc.