User Tools

Site Tools


utf8_nfd_nfc

UTF8 NFD vs NFC

Mac OS uses NFD encoded accents, but doesn't see file or directory names with NFD encoded accents over the network! So files with accents received from Macs and saved from Windows to a Windows share will not be visible from a Mac. The file names must be re-encoded in the NFC form.

Find:

find . | perl -CS -MFile::Basename -MUnicode::Normalize -nle 'next if (/^[A-Za-z\d\_\. \-\/]+$/); $b=basename($_); $nfc=NFC($b); print if ($nfc ne $b)'

Rename:

(Add --notest to actually do the renaming)

convmv -r -f utf8 -t utf8 --nfc . 

Example occurences:

This attachemnt in an email, saved using Thunderbird on Windows 10:

X-Mailer: Apple Mail (2.3445.104.11)
--Apple-Mail=_E5FEA672-E21A-4900-BF9B-B898012144D1
Content-Disposition: inline;
	filename*=utf-8''DCP%20Infos%20Saarbru%CC%88cken.png
Content-Type: image/png;
	x-unix-mode=0644;
	name="=?utf-8?Q?DCP_Infos_Saarbru=CC=88cken=2Epng?="

Whether saved directly to the SMB share or locally on Windows, and then copied to the share, the ü retains it's NFD form as in the header file name.

/docs/dokuwiki/data/pages/utf8_nfd_nfc.txt · Last modified: 2019-11-26 15:23:32 by mi