How to Normalize Unicode Strings in Go

Normalize Unicode strings in Go using the golang.org/x/text/unicode/norm package with NFC or NFD forms.

Use unicode.NFC or unicode.NFD from the golang.org/x/text/unicode/norm package to normalize strings. The NFC form is the standard for most applications, while NFD decomposes characters into base characters and combining marks.

import "golang.org/x/text/unicode/norm"

normalized := norm.NFC.String(input)

For NFD normalization, replace NFC with NFD in the code above.