3 ms·
This is the cost of "extraneous hidden complexity", or as I like to think of it, "abstraction hides bugs". As others here have noted, it is all too tempting to
by userbinator 6y ago
This is the cost of "extraneous hidden complexity", or as I like to think of it, "abstraction hides bugs". As others here have noted, it is all too tempting to use a language whose string type actually does something very fancy, and be unaware of it. Most of the time it "only" causes inefficiency.
I don't remember if the HTTP spec has it, but I clearly remember the HTML spec has some parts that explicitly say "case-insensitive in the ASCII range only" (i.e. 61-7a = 41-5a), presumably to prevent things like this from happening.
- dgellow 6y agoFrom what I got from the spec, HTTP headers are supposed to be ASCII or opaque bytes.
- bzbarsky 6y agoIt's for two (well, at least two) reasons: one is to prevent things like this. The other is that in generally doing case-insensitive stuff for non-ASCII is language-dependent. For example, in English "i" and "I" are case-insensitively equal but in Turkish they are not: "i" is case-insensitively equal to "İ" (U+0130) and "I" is case-insensitively equal to "ı" (U+0131). So if you wanted to do full-unicode case-insensitive things you would need to decide what happens with <DİV> or <dıv> and whether it depends on the language of the page or what. Doing ASCII-only case-insensitivity sidesteps all that, while admittedly privileging English over other languages.