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.