Skip to content
Advertisement

printf in awk with Umlauts doesn’t work

Can somebody please give me an alternative to the following awk statement. As soon as I give a “n” for string, it skips after Umlaut. I don’t want to use gsub because I have many special characters and don’t want to write a script for this.

$ echo "Döll" | awk '{printf "%sn", $0}'
Döll
$ echo "Döll" | awk '{printf "%1sn", $0}'
D

Also if not in awk, can somebody help me in other languages?

Advertisement

Answer

The problem was caused by the LANG variable being set to en_US.UTF-8. After changing it to De_DE.88591, it works like a charm.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement