LazarSoft / jsqrcode

Javascript QRCode scanner
http://www.webqr.com
Apache License 2.0
3.96k stars 1.16k forks source link

Invalid mode: 7 in (block:0 bit:3) #33

Open adambarta opened 10 years ago

adambarta commented 10 years ago

Getting the above error for qr codes generated from zxing

monoxacc commented 7 years ago

Same here. I think the function this.NextMode() doesn't support newer generation qr-codes. In my case a first data block were detected as mode 7 (does not exist), but a next data block were detected as mode 4 (MODE_8BIT_BYTE), which seems correctly, because in the end the algorithm computed the expected result for my qr-code...

I don't know how to fix that, but i found a little dirty workaround for that: The trick is to continue work by mode vaue 7 instead of throwing an error and stop. Simply add an && mode != 7 in the if statement, in Class: src/databr.js line 268 (file were last modified on 16 Sep 2015). So that the code looks like this:

if (mode != MODE_NUMBER && mode != MODE_ROMAN_AND_NUMBER && mode != MODE_8BIT_BYTE && mode != MODE_KANJI && mode != 7)
{ .......