Technical information

Unicode text normalisation can be quite a confusing topic. Apfelstrudel helps you understand what happens in the different normalisation forms, and how conflicts and confusion can occur.

Normalisations in Apfelstrudel are performed by the following four string functions, which are part of the macOS support features in Xcode 10.2.1:

precomposedStringWithCanonicalMapping - which produces Unicode Normalisation Form C ( NFC );

decomposedStringWithCanonicalMapping - which produces Unicode Normalisation Form D ( NFD ), and is that used by HFS+;

precomposedStringWithCompatibilityMapping - which produces Unicode Normalisation Form KC ( NFKC );

decomposedStringWithCompatibilityMapping - which produces Unicode Normalisation Form KD ( NFKD ).

The strings shown undergo no other conversion, and the hexadecimal codes shown are UTF-8 byte codes resulting from literal representation of those strings.

All file and folder names used in the Mac Extended file system, HFS+, undergo normalisation using Form D, NFD. APFS does not undertake any normalisation, whether used in its original case-sensitive variant, or its newer case-insensitive variant. However calls made through macOS features should now perform normalisation. Currently the use (or not) of normalisation is not made clear in the documentation of many of those calls. You can use Apfelstrudel to check whether particular calls result in normalisation or not, because Apfelstrudel makes it easy to see the different normalised forms.

These four normalisations are many-to-one mappings: several different un-normalised strings can be normalised to the same string. Once normalised using one of the forms, normalising that normalised string again using the same form will always leave it unchanged. However, it is not possible to reverse the process of normalisation: you cannot guarantee to predict what the original string was from its normalised form.

Apfelstrudel’s icon shows a real apfelstrudel made according to the Vienna recipe; the image was made by Burkhard Mücke, and obtained through Wikimedia Commons.

Why the name? I wanted a word which incorporated the letters A, P, F, and S; it also, of course, neatly refers to Apple. And everyone loves apfelstrudel.

Back to Welcome

The Eclectic Light Company blog (external link)

Wikipedia on normalisation (external link)

The Eclectic Light Company – https://eclecticlight.co