title: Storing binary data in QR codes
body: <p>I'm trying to store binary data in a QR code. Apparently QR codes do support storing raw binary data (or ISO-8859-1 / Latin1). Here is what I want to encode (hex):</p>
  
  <pre><code>d1 50 01 00 00 00 f6 5f 05 2d 8f 0b 40 e2 01
  </code></pre>
  
  <p>I've tried the following encoders:</p>
  
  <ol>
  <li><a href="http://neocotic.com/qr.js/" rel="noreferrer">qr.js</a></li>
  </ol>
  
  <p><img src="https://i.stack.imgur.com/zvhMq.png" alt="qrjs"></p>
  
  <ol start="2">
  <li><a href="https://developers.google.com/chart/infographics/docs/qr_codes" rel="noreferrer">Google Charts</a></li>
  </ol>
  
  <p><img src="https://chart.googleapis.com/chart?cht=qr&amp;chs=512x512&amp;choe=ISO-8859-1&amp;chl=%d1%50%01%00%00%00%f6%5f%05%2d%8f%0b%40%e2%01" alt="charts"></p>
  
  <ol start="3">
  <li><a href="https://davidshimjs.github.io/qrcodejs/" rel="noreferrer">qrcode.js</a></li>
  </ol>
  
  <p><img src="https://i.stack.imgur.com/ejHWd.png" alt="qrcode.js"></p>
  
  <p>Decoding with <a href="http://zxing.org/" rel="noreferrer">zxing.org</a> produces various incorrect results. The two javascript ones produce this (it's wrong; the first text character should be Ñ.</p>
  
  <p><img src="https://i.stack.imgur.com/d2B0V.png" alt="qr.js and qrcode.js"></p>
  
  <p>Whereas Google Charts produces this...</p>
  
  <p><img src="https://i.stack.imgur.com/ZD5v8.png" alt="charts what"></p>
  
  <p>What is going on? Are any of these correct? What's really weird is that if I encode this sequence (with the JS ones at least) then it works fine - I would have thought the issue was non-ASCII characters but Ñ (<code>0xd1</code>) is non-ASCII.</p>
  
  <pre><code>d1 50 01 00 00 00 01 02 03 04 05 06 40 e2 01
  </code></pre>
  
  <p>Does anyone know what is going on?</p>
  
  <p><strong>Update</strong></p>
  
  <p>It occurred to me to try scanning them with a ZBar-based scanner app I found. It scans both JS versions ok (at least they start with ÑP). The Google Charts one is just wrong. So it seems like the issue is with ZXing (which is surprisingly shit - I wouldn't recommend it to anyone).</p>
  
  <p><strong>Update 2</strong></p>
  
  <p>ZBar can't handle null bytes. :-(</p>