TIL the assumption that string length does not change when upper-cased is false
The issue is that the concept of “length” without additional context no longer applies to Unicode strings. There’s not one length there’s four or five - at least.<p>1. Length in the context of storage or transmission is the number of bytes of its UTF-8 representation - and not just that, one of its decomposed forms too.<p>2. Length in terms of number of visible characters is the number of grapheme clusters.<p>3. Length in terms of visible space on screen is the number of pixels wide and tall when rendered in a given font.<p>4. Length when parsing is based on the number of code points.<p>If you look at it that way it makes perfect sense that the “length” of a string could change when any operation is performed on it - because there’s no such thing as a canonical length.<p>tl;dr bug or not, the concept of a canonical string length is an anachronism from the pre-Unicode days when all those were the same thing. There’s no such thing as a string length anymore.