mylofi/qr-data-sync

fix how data is encoded into the QRs

Open

#2 创建于 2025年12月22日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)JavaScript (4 fork)github user discovery
enhancementhelp wanted

仓库指标

Star
 (86 star)
PR 合并指标
 (PR 指标待抓取)

描述

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

贡献者指南