Wrong version calculated for numeric data of 3283 digits
fred-wang opened this issue · comments
From https://www.qrcode.com/en/about/version.html capacity of version 26 in low level is 10960bits, this gives a numeric data of 3283=3 * 1094+1 digits (4bits of mode, 12 bits of length, 10 * 1094 bits for 3 * 1094 digits, 4 bits for 1 digit).
However when trying to encode a number of 3283 digits, version 27 is used instead:
./qrencode -V
printf '0%.0s' {1..3283} > input.txt
./qrencode -r input.txt -o output.png --margin=0 --size=1
echo "Version:" $(((`identify -format "%w" output.png` - 17)/4))
Output:
qrencode version 4.1.0
Copyright (C) 2006-2017 Kentaro Fukuchi
Version: 27
Note that I tested with the max numeric capacity of all the other versions and 26 is the only one showing this problem.
I have committed a bug fix that closes this issue to the development branch. Plus, I found another bug related to your report and fixed it. Thank you for your great contribution.
Soon I'll release 4.1.0.
@fukuchi Great. Thanks for the quick fix and for developing libqrencode 👍 Looking forward to the next version!