unorml

a command tool to normalize/normalise strings according to any of the standard Unicode forms
by Howard Oakley of https://electiclight.co

Usage:

unorml -[x] string

to return the Unicode normalized version of the given string
for normalization forms C, D, KC, and KD
according to options -c, -d, -kc, -kd respectively

unorml -h to show usage information

Technical information:

This simple tool uses the following functions:
NSString.precomposedStringWithCanonicalMapping to generate the form C (NFC) output
NSString.decomposedStringWithCanonicalMapping to generate the form D (NFD) output
NSString.precomposedStringWithCompatibilityMapping to generate the form KC (NFKC) output
NSString.decomposedStringWithCompatibilityMapping to generate the form KD (NFKD) output

(Xcode 8.3 on macOS 10.12.4 with Swift 3.1.)

Example:

unorml -d 'café'
entered using the default C form returns the D form:
café

You can check the normalisation of strings using my free app Apfelstrudel, available from the Downloads page on my blog.

The input string can be as large as any permitted by NSString, which is larger than any that you'd want (2^64 - 1 or thereabouts).

Version 2.0 has been ported to Swift 3.2 and built with Xcode 9 for compatibility with High Sierra, as well as with Sierra.

Howard Oakley
Version 1.0, 9 April 2017
Version 2.0, 20 September 2017
https://electiclight.co
