mylofi/qr-data-sync

fix how data is encoded into the QRs

Open

#2 geöffnet am 22. Dez. 2025

Auf GitHub ansehen
 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (4 Forks)github user discovery
enhancementhelp wanted

Repository-Metriken

Stars
 (86 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

The "qrcode.js" library bundled in here requires its data to be provided as text, which is why this library currently expects a string OR an object that can be JSON.stringify(..)'d.

However, this can (depending on presence of unicode characters in the string), result in incorrect/buggy internal string length computations inside that library, which leads to exceptions in some cases. Ugh.

A "fix" to work around this was sketched out by me here. It provides a better way of interacting with this library, to push in arbitrary byte data rather than strings.

So qr-data-sync should change to use that patch and push its stuff in binary as well. Should avoid any potential unicode issues.

This won't be a breaking change at all to fix that bug. It may bump the "version" of the frame encoding.

But additionally, the public API will be extended so you can pass in a Uint8Array instance if you want to use this library to chunk up arbitrary binary data -- like an image! -- (without having to go through the mess and size bloat of base64 encoding it to a string first).

Contributor Guide