I need to make diff
ignore the case of my inputs. Both inputs contain German umlauts like ä and Ä. Option -i
successfully makes diff
ignore the case of my input for other characters like a and A, but not for umlauts:
$ diff -i <(echo ä) <(echo Ä)
1c1
< ä
---
> Ä
The output should be empty, as ä and Ä should be seen as the same letter if case is ignored. If I try this instead:
$ diff -i <(echo a) <(echo A)
Then it works as expected (no output).
I also tried to set the environment variable LANG
to make diff
use the correct locale, but this didn’t seem to have any influence:
LANG=de_DE.UTF-8 diff -i <(echo ä) <(echo Ä)
I tried various values for LANG
.
Is there a way to make diff
ignore the case of German umlauts?
(I’m on Ubuntu 22.04 FWIW.)
2
Answers
A simple approach:
utf
is probably not a good choice)Compare normalized strings, see Unicode normalization forms:
Note: used
uconv
fromsudo apt install icu-devtools
FYI: