4 ms·
Is it safe to uppercase the protocol part of the URL? I decided to use segments and stick to lowercase "https", because I didn't trust various implementations
by jwr 2y ago
Is it safe to uppercase the protocol part of the URL?
I decided to use segments and stick to lowercase "https", because I didn't trust various implementations out there to handle "HTTPS" correctly. Should I?
- lifthrasiir 2y agoIn which case, you can still uppercase the domain to get a partial size reduction as QR code does allow for switching to other encoding modes in stream.
- toast0 2y agoIf you control the destination server, you can also upper case the path. In the old days, Yahoo's build of Apache (yApache) included an option to automatically lower case urls before matching them. Super handy because lots of urls were coming in from print publications and you could never get publications to show urls properly, nor get users to type them in properly.
- tln 2y agoHow many implementations do you care about? All major phones do very well at QR scanning these days including uppercase URLs. Leaving a naked domain name like "www.example.com/1234" was not quite as good, but at least iPhones, Pixels and Samsungs worked well IIRC. I used this trick to allow printing of QR codes at smaller resolutions for 4+ years, and phones have gotten noticeably better in that span at handling QR codes printed at smaller sizes, with uppercase, nonstandard shapes, borders, you name it. If you make https: lowercase and the rest uppercase, with QR encoding that does smart segmentation, I'm pretty sure you can still get most of the benefit... but, exercise for the reader. The smallest v1 QR code is 21 modules. That can fit 20 uppercase letters. The 25 module size, is not that much bigger and can get 38 uppercase or 26 lowercase letters.
- dgl 2y agoStrangely not including the scheme doesn't seem to consistently work on an iPhone when in uppercase, a string like "FOO.COM/BAR" does open as a URL, but a string like "FOO.UK/BAR" does a search. I think it's best to include the full HTTPS:// prefix (and I don't think it being uppercase really matters, I'd be surprised if that breaks anything).
- slig 2y agoI did a lot of trial and concluded the same: for non .COM address we had to use the full HTTPS:// prefix otherwise iOS won't open it. On Android it opens any TLDs, even unusual ones like .MD or .NZ.
- jwr 2y ago> If you make https: lowercase and the rest uppercase, with QR encoding that does smart segmentation, I'm pretty sure you can still get most of the benefit... but, exercise for the reader. That is actually exactly what I ended up doing. I care about all mobile phones and tablets, and I was worried whether any implementers actually tested uppercase protocol names.
- zerocrates 2y agoRFC 1738 and 2396 both say schemes are lowercase but implementers "should" treat uppercase as equivalent. RFC 3986 explicitly says schemes can have uppercase letters but are canonically lowercase, and says that they are case-insensitive. But it also still says that implementations "should" accept uppercase letters as equivalent. WHATWG's URL standard mandates case-insensitive matching. In practice anything you scan a QR code with will probably not have a problem with the uppercase scheme.
- Zamicol 2y agoOn this exact issue my work did extensive testing and researching various standards. Although we found browsers were out of alignment with standards on all sorts of matters, we found broad compatibility with upper case. (Of course, meaning everything before the path. The interpretation of the path is delegated to the server which may or may not be case sensitive, up until octothorpe, #, which is then solely interpreted by the browser.)