Converting UTF-8 NFD filenames to UTF-8 NFC, in either rsync or afpd
Solution 1:
You can use rsync's --iconv
option to convert between UTF-8 NFC & NFD, at least if you're on a Mac. There is a special utf-8-mac
character set that stands for UTF-8 NFD. So to copy files from your Mac to your NAS, you'd need to run something like:
rsync -a --iconv=utf-8-mac,utf-8 localdir/ mynas:remotedir/
This will convert all the local filenames from UTF-8 NFD to UTF-8 NFC on the remote server. The files' contents won't be affected.
Solution 2:
Currently I'm using rsync --iconv
like this:
Copying files from Linux server to OS X machine
You should execute this command from OS X machine:
rsync -a --delete --iconv=UTF-8-MAC,UTF-8 '[email protected]:/home/username/path/on/server/' /Users/username/path/on/machine/
Copying files from OS X machine to Linux server
You should execute this command from OS X machine:
rsync -a --delete --iconv=UTF-8-MAC,UTF-8 /Users/username/path/on/machine/ '[email protected]:/home/username/path/on/server/'
Solution 3:
Note: If you are using version 3.0.0 or newer of rsync, the
--iconv
option as mentioned in the other answers is clearly the superior solution.
Something that should work is rsyncing between the source directory and the mounted remote file system (SMB, NFS, AFP), which rsync will just treat as local file system.
However, I do not know how well this works in practice, and you have to work around different issues, for example the delta-transfer algorithm won’t be used by default (since source and destination are “local”) (maybe --no-whole-file will work?), you have to check,e.g., that SMB effectively preserves modification times, etc.