Making ẞ lowercase on MacOS bash

Viewed 105

I have a problem with lowercasing ß character on MacOS. In all tools which I use for lowercasing (gawk and tr, awk has problems with encoding) it is not lowercased at all. Other special characters are lowercased correctly. Could anyone have some solution for that?

Examples:

tr

echo üäößÜÄÖẞ | tr '[:upper:]' '[:lower:]'
üäößüäöẞ

gawk

echo üäößÜÄÖẞ | gawk '{print tolower($0)}'
üäößüäöẞ
2 Answers

Option 1: perl

echo 'üäößÜÄÖẞ' | perl -CSD -ne 'print lc'

enter image description here


Option 2: tr

echo üäößÜÄÖẞ | tr ẞ ß

Because both ẞ and ß are completely 'different' characters, the common tools don't know the lowercase version.

As @Thilo suggested, you could use tr [option] stringValue1 [stringValue2] to tell tr to 'replace' ẞ with an ß


enter image description here

Try with GNU sed:

$ echo üäößÜÄÖẞ | sed 's/./\L&/g'
üäößüäöß
Related