How are different content types within QR-Codes distinguished?

泪湿孤枕 提交于 2019-12-13 05:23: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.



来源:https://stackoverflow.com/questions/33774027/how-are-different-content-types-within-qr-codes-distinguished

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!