phpstringutf-8linguistics

Convert lower case letter 'ß' to upper case letter 'ẞ' in PHP


I'm trying to convert the lower case letter 'ß' to the upper case pendant. I already tried using the built-in functions strtoupper and mb_strtoupper.

The following happened when I use strtoupper:

echo strtoupper('ß'); // leads to 'ß'

The following happened when I use mb_strtoupper:

echo mb_strtoupper('ß', 'UTF-8'); // leads to 'SS'

Solution

  • Have a look at this answer for why Python has a similar behaviour https://stackoverflow.com/a/62769447/11924322

    This explains why PHP also has this behaviour.