๐Ÿ“š General & Other

Uppercasing Can Change String Length

Most code assumes case conversion is a one-to-one character mapping. It is not, and the assumption breaks in ways that are easy to miss.

Most code assumes case conversion is a one-to-one character mapping. It is not, and the assumption breaks in ways that are easy to miss.

One character becomes two

German รŸ uppercases to SS. Certain ligatures expand similarly. Any code allocating a fixed-size buffer based on the input length, or validating that a field still fits a column after uppercasing, can overflow on real input.

Not reversible

Uppercase then lowercase does not return the original string. Once รŸ has become SS, the information is gone. Never store only the uppercased form of data you will need to display.

Locale applies here too

The Turkish dotless i works in this direction as well: lowercase i uppercases to ฤฐ in Turkish and I elsewhere.

For comparison, prefer folding

If the goal is caseless matching, case folding is the operation designed for it. Uppercasing both sides of a comparison is a common shortcut that produces wrong answers on exactly the inputs nobody tests with.

Try it: Convert Text to Uppercase on SeoWolf's Notepad.