You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DetectedBarcode.rawValue could be binary data. #35
I've investigated the question of whether or not QR codes can contain binary data and found that it is not the case. The "binary mode" seems to default to the ISO-8859-1 but can be overridden to other character sets using ECI hints.
Importantly, in our implementation experience within Chromium we found that the barcode detection APIs on Android and macOS return the decoded value as their native string types which are defined as containing UTF-16 codepoints.
Just for further information, I have built a "proof" that QR codes can indeed support binary data encoded and decoded.
I forked the qrcodejs library and added a way to force raw bytes into the QR code, then I forked the qr-scanner library so that if I scan a QR code encoded with binary data, it comes out raw WITHOUT any text transformation (which is inherently susceptible to different choices of character encodings).
I've tested this on several platforms and with a variety of different binary data, and it seems to be working seamlessly.
The unfortunate part of my qr-scanner fork is that I had to forcibly disable it from using the native BarcodeDetector web API, so that it falls back to its included port of Google's ZXing library.
From a performance perspective, it'd be highly preferable if this API could be updated to support the raw binary data on the result. Ideally, this API (with binary data support) would eventually be widespread enough the scanner library could drop its inclusion of the ZXing library port altogether.
Activity
reillyeon commentedon Jul 22, 2019
I've investigated the question of whether or not QR codes can contain binary data and found that it is not the case. The "binary mode" seems to default to the ISO-8859-1 but can be overridden to other character sets using ECI hints.
Importantly, in our implementation experience within Chromium we found that the barcode detection APIs on Android and macOS return the decoded value as their native string types which are defined as containing UTF-16 codepoints.
reillyeon commentedon Jan 31, 2020
I have repeated this analysis in investigating Chromium issue 1023177 and determine that this data in available from platform barcode scanning APIs.
getify commentedon Dec 24, 2025
Any chance this could be revived?
getify commentedon Dec 29, 2025
Just for further information, I have built a "proof" that QR codes can indeed support binary data encoded and decoded.
I forked the qrcodejs library and added a way to force raw bytes into the QR code, then I forked the qr-scanner library so that if I scan a QR code encoded with binary data, it comes out raw WITHOUT any text transformation (which is inherently susceptible to different choices of character encodings).
I've tested this on several platforms and with a variety of different binary data, and it seems to be working seamlessly.
The unfortunate part of my qr-scanner fork is that I had to forcibly disable it from using the native
BarcodeDetectorweb API, so that it falls back to its included port of Google's ZXing library.From a performance perspective, it'd be highly preferable if this API could be updated to support the raw binary data on the result. Ideally, this API (with binary data support) would eventually be widespread enough the scanner library could drop its inclusion of the ZXing library port altogether.
jimmywarting commentedon Jan 1, 2026
think we should have something like what already exist in push event, blob & fetch
namely: