Describe the bug
If a QR code is mirrored, zxing library is unable to read it.
To Reproduce
Try to scan a mirrored QR code, such as the attached one. At least qrfy.com seems to generate these out of the box.
Expected behavior
The QR code contents ("test2") scanned succesfully.
Screenshots
Desktop (please complete the following information):
OS: MacOS 14 tested
Browser: Chrome & Firefox tested
Version: Chrome 126, Firefox 126
Smartphone (please complete the following information):
Device: Samsung Galaxy Z Flip 5
OS: Android 14
Browser: Firefox
Version: 126
Additional context
So I dug around the source and seems like on a failed scan zxing already tries to mirror the QR code, but is unsuccesful. This seemed perplexing so I dug around and it seems like the fault is at src/core/qrcode/decoder/BitMatrixParser.ts: in remask() if I change the line var dataMask = DataMask.values[this.parsedFormatInfo.getDataMask()]; to var dataMask = DataMask.values.get(this.parsedFormatInfo.getDataMask()); I'm able to read the mirrored code.
Describe the bug If a QR code is mirrored, zxing library is unable to read it.
To Reproduce Try to scan a mirrored QR code, such as the attached one. At least qrfy.com seems to generate these out of the box.
Expected behavior The QR code contents ("test2") scanned succesfully.
Screenshots
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context So I dug around the source and seems like on a failed scan zxing already tries to mirror the QR code, but is unsuccesful. This seemed perplexing so I dug around and it seems like the fault is at
src/core/qrcode/decoder/BitMatrixParser.ts
: inremask()
if I change the linevar dataMask = DataMask.values[this.parsedFormatInfo.getDataMask()];
tovar dataMask = DataMask.values.get(this.parsedFormatInfo.getDataMask());
I'm able to read the mirrored code.