kizzx2 / haskell-qrcode

QR Code encoder in pure Haskell
http://hackage.haskell.org/package/qrcode
BSD 3-Clause "New" or "Revised" License
16 stars 8 forks source link

Alphanumeric qrcode generation issue #1

Open jgreene opened 13 years ago

jgreene commented 13 years ago

Alphanumeric code generation fails on any input above 20 characters. It will produce data for a qrcode, but the qrcode is invalid and cannot be read by scanners. This can be reproduced by increasing the length of the data being used in the Example.hs file to 21 characters.

stoltene2 commented 12 years ago

This breaks because the standard has length limitations for each version and encoding. Try increasing the version.

mihaigiurgeanu commented 7 years ago

The problem is not the length limitations of the QRCode. I tried the following configurations:

(I will write UNREADABLE for each configuration that generated an ureadable QR code and OK for configurations that generated readable QR codes)

OK:

>>>>>>>>"HELLO WORLD HELLO WORLD H"<<<<<<<<<
Length of text is 25
Using configuration (Version 1,L)
Array bounds: ((0,0),(20,20))

UNREADABLE:

>>>>>>>>"HELLO WORLD HELLO WORLD HE"<<<<<<<<<
Length of text is 26
Using configuration (Version 2,Q)
Array bounds: ((0,0),(24,24))

OK:

>>>>>>>>"HELLO WORLD HELLO WORLD HE"<<<<<<<<<
Length of text is 26
Using configuration (Version 2,L)
Array bounds: ((0,0),(24,24))

UNREADABLE:

>>>>>>>>"HELLO WORLD HELLO WORLD HE"<<<<<<<<<
Length of text is 26
Using configuration (Version 2,M)
Array bounds: ((0,0),(24,24))

UNREADABLE:

>>>>>>>>"HELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HE"<<<<<<<<<
Length of text is 260
Using configuration (Version 8,L)
Array bounds: ((0,0),(48,48))

UNREADABLE:

>>>>>>>>"HELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HE"<<<<<<<<<
Length of text is 260
Using configuration (Version 9,L)
Array bounds: ((0,0),(52,52))

UNREADABLE:

>>>>>>>>"HELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HE"<<<<<<<<<
Length of text is 260
Using configuration (Version 10,L)
Array bounds: ((0,0),(56,56))

UNREADABLE:

>>>>>>>>"HELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HEHELLO WORLD HELLO WORLD HE"<<<<<<<<<
Length of text is 260
Using configuration (Version 15,L)
Array bounds: ((0,0),(76,76))

Please note that, according to QRCode.com, a QR Code version 2 with error correction level Q should have a capacity of 29 alphanumeric characters and I tried with 26.

Also, a QR code version 8 with error correction level L should be able to encode up to 279 alphanumeric characters. I tried with 260, and could not get a readable QR code even if I used version 15, which should have a capacity of 758 alphanumeric characters for error correction level L.

I am attaching the QR Code obtained for the last sample, 260 characters, Version 15, Level L.

xaa

kizzx2 commented 7 years ago

https://github.com/kizzx2/haskell-qrcode/commit/5dabe451dafadb376e966e44bfc1f777ef639044 fixes the issue for all of the above cases except (Version 15, L)

Still trying to debug what the issue is with (Version 15, L)