Search code examples
unicodeequivalentvimdiff

Make vimdiff ignore unicode equivalence classes


I try to compare two directories synced by synching. I do this using the following:

vimdiff <(cd "~/Pictures/shared" && find . | sort) <(ssh argon "cd ~/pictures/shared && find . " | sort) 

One machine is a recent archlinux box and the local machine is a MacBook Pro. Skimming through the diff I have problems finding real differences because most of the differences are Umlauts that get somehow interpreted wrong:

vimdiff

Hexdump shows the character differ. Here its a german ö (U+00F6) while there it is a o with combining diaeresis ◌̈ (U+0308). Is vimdiff capable of recognizing these equivalences as identical?


Solution

  • I found a way to translate the encoding before comparing them by piping the output through iconv -f utf-8 -t utf-8-mac:

    vimdiff <(cd ~/Pictures/shared && find . | sort) <(ssh argon "cd ~/pictures/shared && find . " | iconv -f utf-8 -t utf-8-mac | sort)
    

    Also see this question on iconv.