This Haskell library implements the algorithm "StringPrep" from RFC3454.
It is available on Hackage under the name "stringprep".
Simple usage looks something like:
import Text.StringPrep (runStringPrep)
import Text.StringPrep.Profiles (namePrepProfile)
namePreppedText = runStringPrep namePrepProfile yourText