{"id":2276,"date":"2017-02-23T12:50:52","date_gmt":"2017-02-23T12:50:52","guid":{"rendered":"http:\/\/www.bardecode.com\/en1\/?p=2276"},"modified":"2017-02-23T12:50:52","modified_gmt":"2017-02-23T12:50:52","slug":"binary-data-in-datamatrix-bar-codes","status":"publish","type":"post","link":"https:\/\/www.bardecode.com\/en1\/binary-data-in-datamatrix-bar-codes\/","title":{"rendered":"Binary data in DataMatrix bar codes"},"content":{"rendered":"<p>It is possible to store binary data in DataMatrix barcodes, but how do you go about accurately recovering the information?<\/p>\n<p>Take the simple and obvious example of a datamatrix barcode that contains the text &#8220;ABCDE&#8221;. This can be encoded in multiple ways (e.g C40 or Text Encoding) but the output from the reader will always be &#8220;ABCDE&#8221;.<\/p>\n<p>In the case of binary data, you don&#8217;t need to know what encoding method was used in the datamatrix bar code, but you do need to know how our SDK has encoded the data.<\/p>\n<p>The encoding of data is through the property called Encoding (ST_ENCODING in the Linux SDK).<\/p>\n<p>This can take 1 of 4 values with the default being UTF-8:<\/p>\n<p>0  Raw , with null characters suppressed.<br \/>\n1  Quoted printable<br \/>\n2  Unicode<br \/>\n3  UTF-8<\/p>\n<p>When testing with binary data it is useful to set the encoding to 1 since the string can be easily printed and understood by a human. Non-printable characters are printed as =XX where XX is the hex value of the byte. Printable characters are printed as normal.<\/p>\n<p>Raw format works so long as you don&#8217;t have null characters in your binary data.<\/p>\n<p>Note that UTF-8 is not actually an encoding method used in a datamatrix barcode, although the data may happen to already be in UTF-8 format. This can result in double UTF-8 encoding when it is decoded and so we have an additional parameter called  DataMatrixAutoUTF8 (ST_DATAMATRIX_AUTO_UTF8 in the Linux SDK) which assesses the data to see if it is already in UTF-8 format before encoding it. If it is already in UTF-8 format and the encoding is set to UTF-8 then it is left alone.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It is possible to store binary data in DataMatrix barcodes, but how do you go about accurately recovering the information? Take the simple and obvious example of a datamatrix barcode that contains the text &#8220;ABCDE&#8221;. This can be encoded in multiple ways (e.g C40 or Text Encoding) but the output from the reader will always<\/p>\n<p><a href=\"https:\/\/www.bardecode.com\/en1\/binary-data-in-datamatrix-bar-codes\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":328,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18,31],"tags":[],"class_list":["post-2276","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-knowledge-base","category-software-development-kits"],"_links":{"self":[{"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts\/2276"}],"collection":[{"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/comments?post=2276"}],"version-history":[{"count":1,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts\/2276\/revisions"}],"predecessor-version":[{"id":2277,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts\/2276\/revisions\/2277"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/media\/328"}],"wp:attachment":[{"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/media?parent=2276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/categories?post=2276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/tags?post=2276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}