heuer/segno

Unable to create QR codes with modes less than binary/'bytes'

Closed this issue · 2 comments

I think https://github.com/heuer/segno/blob/master/segno/encoder.py#L1040 will cause https://github.com/heuer/segno/blob/master/segno/encoder.py#L1049 to always fail for numeric, alphanumeric, and structured append modes. Specifically, I'm trying to create an alphanumeric microQR code in mode M2 with the following line:

segno.make_micro("text", version="M2", mode="alphanumeric")

And I don't think Segno will allow me to do it with any data - but I'm pretty tired right now. Maybe I'm missing something?

Oops - turns out the alphanumeric mode is only selectable with uppercase characters, there's no case-folding. My thoughts about the code-path were wrong. Closing, sorry!

heuer commented

Glad you found it out yourself. In alphanumeric mode the following characters are allowed: ABCDEFGHIJKLMNOPQRSTUVWXYZ$%*+-./:, and space .

If the version does not matter, you can omit the mode and version information and Segno creates an optimal, minimal Micro QR Code for the provided input:

>>> qr = segno.make_micro("text")
>>> qr.designator
'M3-M'

The Structured Append mode is not supported by Micro QR Codes, only by QR Codes.