qr-codezxing

Storing binary data in QR codes


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):

d1 50 01 00 00 00 f6 5f 05 2d 8f 0b 40 e2 01

I've tried the following encoders:

  1. qr.js

qrjs

  1. Google Charts

charts

  1. qrcode.js

qrcode.js

Decoding with zxing.org produces various incorrect results. The two javascript ones produce this (it's wrong; the first text character should be Ñ.

qr.js and qrcode.js

Whereas Google Charts produces this...

charts what

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 Ñ (0xd1) is non-ASCII.

d1 50 01 00 00 00 01 02 03 04 05 06 40 e2 01

Does anyone know what is going on?

Update

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).

Update 2

ZBar can't handle null bytes. :-(


Solution

  • It turned out that ZXing is just crap, and ZBar does some weird stuff with the data (converting it to UTF-8 for example). I managed to get it to output the raw data including null bytes though. Here is a patch for the best Android ZBar library I found, that has now been merged.