{"id":1868,"date":"2013-10-02T09:49:21","date_gmt":"2013-10-02T09:49:21","guid":{"rendered":"http:\/\/www.bardecode.com\/newsite\/?p=1868"},"modified":"2024-07-10T16:50:09","modified_gmt":"2024-07-10T16:50:09","slug":"qr-codes-and-utf-8-encoding","status":"publish","type":"post","link":"https:\/\/www.bardecode.com\/newsite\/qr-codes-and-utf-8-encoding\/","title":{"rendered":"QR-Code and UTF-8 encoding"},"content":{"rendered":"<p>This article explains issues relating to the use of <a href=\"https:\/\/en.wikipedia.org\/wiki\/QR_code\">QR-Code<\/a> and <a href=\"https:\/\/en.wikipedia.org\/wiki\/UTF-8\">UTF-8<\/a> data.<\/p>\n<p>There are several ways in which data can be stored in a <a href=\"https:\/\/en.wikipedia.org\/wiki\/QR_code\">QR-Code<\/a>, one of which is called Byte Mode. This mode allows data to be encoded in a sequence of 8-bit byte values, in other words an array of integer values ranging from 0 to 255. The default interpretation of these values is from the <a href=\"https:\/\/en.wikipedia.org\/wiki\/ISO\/IEC_8859-1\">ISO\/IEC 8859-1<\/a> symbol set. In this symbol set each value from 0 to 255 equates to a specific symbol and the number of symbols available is exactly 256. To extend the range of symbols available it is possible to use alternative character sets such as <a href=\"https:\/\/en.wikipedia.org\/wiki\/UTF-8\">UTF-8<\/a>, however there are some issues that developers should be aware of&#8230;.<\/p>\n<p><strong>Auto-detection of UTF-8<\/strong><\/p>\n<p>A barcode reader does not automatically know that data has been encoded using <a href=\"https:\/\/en.wikipedia.org\/wiki\/UTF-8\">UTF-8<\/a> unless an <a href=\"https:\/\/en.wikipedia.org\/wiki\/Extended_Channel_Interpretation\">ECI (Extended Channel Interpretation)<\/a> has been used (see below). But it can make a guess&#8230;<\/p>\n<p>A test can be applied to a sequence of byte values to see whether or not it can be interpreted as <a href=\"https:\/\/en.wikipedia.org\/wiki\/UTF-8\">UTF-8<\/a> data, however this does not mean that the sequence isn&#8217;t also valid <a href=\"https:\/\/en.wikipedia.org\/wiki\/ISO\/IEC_8859-1\">ISO\/IEC 8859-1<\/a> data. For example, the character \u00e6 can is represented by the <a href=\"https:\/\/en.wikipedia.org\/wiki\/UTF-8\">UTF-8<\/a> byte sequence C3 A6 (hex values). But C3 A6 in <a href=\"https:\/\/en.wikipedia.org\/wiki\/ISO\/IEC_8859-1\">ISO\/IEC 8859-1<\/a> represents the characters \u00c3 and |. So this test relies on the fact that it&#8217;s unlikely to see the combination of \u00c3| in text.<\/p>\n<p>In practice this test works well but developers should be aware of the possibility of incorrect interpretation of valid <a href=\"https:\/\/en.wikipedia.org\/wiki\/ISO\/IEC_8859-1\">ISO\/IEC 8859-1<\/a> data.<\/p>\n<p><strong>Extended Channel Interpretation (ECI)<br \/>\n<\/strong><\/p>\n<p>A more reliable way to encode <a href=\"https:\/\/en.wikipedia.org\/wiki\/UTF-8\">UTF-8<\/a> data in a QR-Code is to include an <a href=\"https:\/\/en.wikipedia.org\/wiki\/Extended_Channel_Interpretation\">ECI<\/a> block in the data to specifically inform the reader that the next block of bytes is using UTF-8 rather than the default ISO\/IEC 8859-1 encoding. The <a href=\"https:\/\/en.wikipedia.org\/wiki\/Extended_Channel_Interpretation\">ECI<\/a> block should have the value 000026. Please refer to section 6.4.2 of <a href=\"https:\/\/www.iso.org\/standard\/62021.html\">ISO\/IEC 18004<\/a> Second Edition 2006-09-01 for further information.<\/p>\n<p><strong>Versions of SoftekBarcode.dll<\/strong><\/p>\n<p>Versions of softekbarcode.dll starting from 7.5.1.37 support automatic detection of <a href=\"https:\/\/en.wikipedia.org\/wiki\/UTF-8\">UTF-8<\/a> data and <a href=\"https:\/\/en.wikipedia.org\/wiki\/Extended_Channel_Interpretation\">ECI<\/a>\/<a href=\"https:\/\/en.wikipedia.org\/wiki\/UTF-8\">UTF-8<\/a> interpretation. An advanced parameter called QRCodeAutoUTF8 controls automatic detection of <a href=\"https:\/\/en.wikipedia.org\/wiki\/UTF-8\">UTF-8<\/a> and can either be set to 1 (True) or 0 (False). If barcodes are using an <a href=\"https:\/\/en.wikipedia.org\/wiki\/Extended_Channel_Interpretation\">ECI<\/a> block then it is safe to set the QRCodeAutoUTF8 to False or 0. Please contact <a title=\"support@bardecode.com\" href=\"mailto:support@bardecode.com\">support@bardecode.com<\/a> if you require a version with these features.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article explains issues relating to the use of QR-Code and UTF-8 data. There are several ways in which data can be stored in a QR-Code, one of which is called Byte Mode. This mode allows data to be encoded in a sequence of 8-bit byte values, in other words an array of integer values &hellip; <\/p>\n","protected":false},"author":1,"featured_media":1802,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30,236,18,76],"tags":[],"class_list":["post-1868","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-barcode-specification","category-documentation-for-our-toolkits-and-applications","category-knowledge-base","category-settings"],"_links":{"self":[{"href":"https:\/\/www.bardecode.com\/newsite\/wp-json\/wp\/v2\/posts\/1868"}],"collection":[{"href":"https:\/\/www.bardecode.com\/newsite\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bardecode.com\/newsite\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bardecode.com\/newsite\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bardecode.com\/newsite\/wp-json\/wp\/v2\/comments?post=1868"}],"version-history":[{"count":8,"href":"https:\/\/www.bardecode.com\/newsite\/wp-json\/wp\/v2\/posts\/1868\/revisions"}],"predecessor-version":[{"id":3253,"href":"https:\/\/www.bardecode.com\/newsite\/wp-json\/wp\/v2\/posts\/1868\/revisions\/3253"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bardecode.com\/newsite\/wp-json\/wp\/v2\/media\/1802"}],"wp:attachment":[{"href":"https:\/\/www.bardecode.com\/newsite\/wp-json\/wp\/v2\/media?parent=1868"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bardecode.com\/newsite\/wp-json\/wp\/v2\/categories?post=1868"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bardecode.com\/newsite\/wp-json\/wp\/v2\/tags?post=1868"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}