Text case changes the size of QR codes

(johndcook.com)

75 points | by ibobev 6 days ago ago

15 comments

  • ericpauley 2 hours ago

    A major frustration in my life is that LinkedIn QR codes will not support all caps. It’s not even a profile capitalization issue; the app will refuse to scan the code if the “/in/“ is capitalized. The resulting size difference is quite noticeable particularly in small format.

    • jdndbxbcb an hour ago

      According to the article / is not in basic alphanumeric alphabet anyway?

      • nemetroid an hour ago

        The article has an off-by-one error. There are 45 characters in the basic alphanumeric alphabet, and / is the missing one.

  • zygentoma 3 hours ago

    Wouldn't it have been much more sensible to have a lowercase version of alphanumerics in the QR code standard? Almost all URLs are lowercase, and even if the have capitalised parts, in most cases they're case-insensitive.

    • orangewindies 2 hours ago

      QR codes were created for labelling automotive parts, not for URLs. Part numbers are usually uppercase alphanumeric, with a few punctuation characters.

    • mmulqueen 2 hours ago

      QR codes existed for over a decade before smartphones brought them into the mainstream. They're high density replacements for barcodes, which are uppercase by convention (or in some cases like Code 39, only support uppercase). URLs in QR codes are a later innovation.

    • Etheryte 3 hours ago

      Urls can include parameters and for those capitalization can definitely matter.

  • slig an hour ago

    This tool [1] let me figure that out couple of years ago. And on the printable pages of the sites I own, for instance [2], I use a all caps domain and identifiers so that all my QR Codes are tiny (e.g: `HTTPS://ABC.DE/ABCD/42`, with up to 10 chars in the path).

    [1]: https://www.nayuki.io/page/creating-a-qr-code-step-by-step [2]: https://www.brainzilla.com/logic/zebra/pdf/blood-donation.pd...

  • future10se 4 hours ago

    A similar article was posted earlier this year, discussion here: https://news.ycombinator.com/item?id=43149077

  • chrismorgan 2 hours ago

    > Alphanumeric data, in the context of QR codes, comes from the following alphabet of 44 characters:

    > 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-.:

    This is wrong: alphanumeric has 45 characters, not 44. It’s missing the second last character, /.

    (The slash is important because it makes alphanumeric-mode URLs possible: you can write HTTPS://EXAMPLE.COM/PATH which will be parsed to https://example.com/PATH. No query string or fragment due to no ?&=#, and your server must accept the uppercase path, either serving it or redirecting to the lowercase and then serving that.)

    An alphabet size of 45 is the largest that will fit into 5½ bits per character (log₂ 45 ≈ 5.49).

  • FinnKuhn 3 hours ago

    This also seems to work for URLs so next time I will create a QR code I will keep this in mind. Really useful!

    I tested this with the following example: https://imgur.com/a/hTsvV3Z

  • mrasong 4 hours ago

    First time learning about this detail.

  • Theodores an hour ago

    I am amazed at how much there is to know about QR codes, particularly if you want them to look pretty.

    I want the super succinct QR code and I believe that to be optimal. However, I keep seeing massively complicated QR codes, as if going from 8 bit to 64 bit, and I assume these work well. Given the amount of megapixels in any camera made this century and the prevalence of over complicated URLs in QR form, I am not sure if minimised QR codes have any benefit whatsoever. By minimised, I mean 29 x 29.

    On the QR topic, I don't understand how logos in the middle work. You are losing pixels and checks with the logo in the middle which is fine until you make the logo too big.

    Also related, imagine you wanted a HN QR code with 'Hacker News' written in the middle. This would work as a box in the middle but would be hard to read. So you can make a line across the middle rather than a box in the middle. This will break the QR code but not if you rotate the QR code 90 degrees first.

    Maybe my best option to fully understand the quirks is to start with the QR spec and then to make my own QR codes.

    • dgl an hour ago

      > On the QR topic, I don't understand how logos in the middle work. You are losing pixels and checks with the logo in the middle which is fine until you make the logo too big.

      It is possible to add logos without (well, differently) abusing the error correction: https://research.swtch.com/qart

      Of course most images in the middle aren’t doing that and rely on some level of error correction fixing it.