Enable binary decoding.#80
Enable binary decoding.#80kousu wants to merge 4 commits intoglassechidna:masterfrom kousu:binary-safe
Conversation
There are a lot of fiddly details about transiting between different data encodings. And the QR spec is a bit vague on some parts. I've detailed the problems at the sister project zxing-cpp/zxing-cpp#62 I've decided to patch this in a works-for-me kind of way: unmarked encodings are treated as bianry and if that's not good enough the higher layers have the source material and can try decoding it themselves.
|
It would be good to import https://github.com/nu-book/zxing-cpp/tree/master/test/blackbox to make sure this hasn't introduced any regressions! jsQR has a huge corpus too https://github.com/cozmo/jsQR/tree/master/tests/end-to-end |
|
For comparison, jsQR outputs both text and binary. You almost do this, returning DecoderResult with both An alternate patch would be to rename |
I think I'd generated my expected output from zxing itself. This was generated from the source file with curl https://sampleswap.org//samples-ghost/DRUM%20LOOPS%20and%20BREAKS/161%20to%20180%20bpm/128[kb]161_amenvar3.aif.mp3 | head -c 856 | tee ../tests/amen-01.bin 856 is the packet size qrencode decided to chunk this file into when I first split it up.

I want to be able to pass binary data through QR codes.
qrencodewill let me make QR codes like this, but zxing-cpp won't read them: it clips at the first embedded null, and, if iconv is enabled, chokes trying to interpret data as text in some format. There are a lot of fiddly details about transiting between different data encodings and the QR spec doesn't help by being vague on some parts. I've detailed the problems at the sister projectzxing-cpp/zxing-cpp#62
I've decided to patch this in a works-for-me kind of way: unmarked encodings are treated as binary and if that's not good enough the higher layers have the source material and can try decoding it themselves.
This adds a single lone test for this case, which also means it adds tests to the project CI config.