QRCode bug

57 views
Skip to first unread message

AndrewO

unread,
Oct 12, 2009, 2:44:25 AM10/12/09
to Barby
Hi,

I've been encoding some Unix timestamps + usecs into QRCodes and have
found a few that cause "undefined method `rszf' for nil:NilClass
(NoMethodError)" errors. In the link below there's a script with two
of the offending values in the CODES array and the stacktrace it
produces.

http://gist.github.com/208197

Being new to barcodes in general, I have no idea how to debug this but
would be happy to try to work through something with some handholding.

Thanks,
Andrew

Tore Darell

unread,
Oct 12, 2009, 10:17:42 AM10/12/09
to Barby
Hi Andrew,

Barby uses the RQRCode library [1] for QR codes, and the error comes
from inside that library. I'm not sure if this is a bug in RQRCode or
Barby; it could be that my assumptions as to how RQRCode works are
wrong. It could be worthwhile taking this upstream, I was able to
replicate the error using only RQRCode:

RQRCode::QRCode.new('1255147506745571', :size => 1, :level => :l).to_s

In theory, I think the above should be fine, as the string used falls
within the limit for an 8bit size 1 QR code. Also the error seems to
be related to the contents of the string and not only its length.

I've pushed a change that allows QR codes to have their size set
manually, so you should be able to work around this by using the
latest revision and setting the size to 2:

Barby::QrCode.new('1255147506745571', :size => 2)

This will produce a slightly larger barcode, but it seems to work a
lot better.


Tore


[1] http://rqrcode.rubyforge.org/
Reply all
Reply to author
Forward
0 new messages