Hacker News new | ask | show | jobs
by codeflo 1825 days ago
So instead of extending QR codes, which are inherently binary, to efficiently handle binary payloads, we invent yet another ASCII-based tunneling scheme. Why ever fix any problem when we can just pile workaround upon workaround upon workaround?
4 comments

Qrcode already has a binary mode. The problem is that qrcode software treats qrcode data as text and fucks up. You’re not going to get every software out there fixed.

This does not extent qrcode at all, instead it defines a binary-to-text encoding designed to fit in qrcode’s existing alphanumeric mode, exactly like base32, base64 or base85 (or base36, base62, binhex, quopri) but fitting the specific constraints of the qrcode medium.

> You’re not going to get every software out there fixed.

You don't need every QR code software to be fixed anyway. Only the one which will use those QR codes which don't yet exist. These softwares will have to understand Base45 anyway.

If you wrote that QRcode is not extensible (I don't know if that's the case) I would have agreed.

> You don't need every QR code software to be fixed anyway. Only the one which will use those QR codes which don't yet exist.

No, the existing software misbehaves (and possibly crashes) when scanning pure binary data. If it did nothing problematic then the use of binary data would not matter, only the sofware which “will have to understand base45 anyway” would need to be binary-clean.

And here qrcode software does not need to understand base45: the user can copy the base45 textual data to whichever other program cares for it.

> If you wrote that QRcode is not extensible (I don't know if that's the case) I would have agreed.

Why would I write that when it has nothing to do with the issue?

And qrcode can be extended: the encoding mode is specified by a nibble, only 9 values are currently in use.

Realistically, if you test with the camera apps from Apple, Google and Samsung I suspect you have 90% of the public's usage covered and everyone else will be forced to follow.
Unfortunately, the QR code "binary" mode specification defaults to ISO 8859-1 for the encoding (because it was not originally intended to store actual binary data), and there's also no way to indicate what format is actually encoded. So all decoders of course just assume ISO 8859-1 because they have no way of knowing otherwise.

However, we could in theory get around this by using binary data formats that always begin with an invalid text character (0x80-0x9f). This way, an implementation can know that the data is not ISO 8859-1, and try to decode whatever format it discovers through the beginning byte signature.

I've actually put this into Concise Encoding [1]

[1] https://github.com/kstenerud/concise-encoding/blob/master/cb...

Becaus sometimes you need your solution to be used be the public, voluntarily. If they have to install an extra app to read your "looks-like-QR-code-but-not-quite" thing, then you have at least an increased risk of not getting the adoption you want to get.

This is not a realistic choice for many projects.

Do you mean that humans will have to decode Base45?

If not, there is a software layer anyway. Adding another skin to the onion is not the best way to compress data.

The issue is that there are two layers of software: the SDK, and the software which you write which uses the SDK.

If the crash is happening in the SDK (on binary QR codes), then your only option is to ditch binary QR and implement a workaround.

Because QR code scanners are very widespread already, can be understood by even basic cameras nowadays and some devices are hard to update or would need yet another self-invented thingy, which would make people rather more suspicious if done for something like the use case this initially had – codes for verifying that a person is tested, vaccinated or recovered OK on borders and the like.

I at least find it good that existing solutions still get optimizations, even and are enhanced, vs. just throwing everything away at the slightest issue and redo everything, the that churn just costs a lot of $€£ while never bringing out something mature, i.e., useful for the masses.