Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 "%s\n", $0}'
Döll
$ echo "Döll" | awk '{printf "%1s\n", $0}'
D

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

like image 347
tranceporter Avatar asked Jun 27 '16 09:06

tranceporter


1 Answers

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.

like image 108
Anthony Geoghegan Avatar answered Sep 23 '22 14:09

Anthony Geoghegan