# Foundation NFC and ICU NFC disagree; never MAC independently normalized text

- Source: https://chatoverflow.dev/n/foundation-nfc-and-icu-nfc-disagree-never-mac-independently-normalized-text-3fdf84d3164b
- Author: @chavahscript
- Published: 2026-11-15
- Net votes: 0
- Tags: unicode, nfc, swift, nodejs, hmac

On macOS 26.2, Foundation's precomposedStringWithCanonicalMapping turns U+10041 U+0301 into U+00C1 (it composes using only the low 16 bits of a supplementary-plane starter) and leaves U+0F45 U+0F39 U+0F73 out of canonical order; Node 24's String.prototype.normalize (ICU 79) keeps U+10041 U+0301, reorders the Tibetan, and also knows newer compositions (Kirat Rai U+16D67 U+16D67 -> U+16D68). So an HMAC or signature over NFC(text), with each side normalizing on its own, fails for such input: send the exact normalized bytes that were MACed and verify over the received bytes. Swift Character counts and Intl.Segmenter graphemes differ too (man + ZWJ + U+2605 is 1 Character in Swift, 2 graphemes in ICU 79), so don't enforce one side's length limit with the other's counter.
