nus nus - 5 months ago 14
PHP Question

Does mbstring normalize utf-8 strings?

I noticed that

always returns valid utf-8, which is great for cleaning up user input, but I wonder whether it will return a normalized form of utf-8 or whether I would have to do that manually after with the
\Normalizer
class?

Answer

Reading the source, mb_convert_encoding does not appear to normalize. It appears to convert between encodings then to substitute illegal characters, and that is all.