Normalization
PHP
normalizer_normalize($string, Normalizer::FORM_KD);
normalizer_normalize[link1] -- PHP Normalizer class
JS
String.prototype.normalize()str.normalize('NFC');
String.prototype.normalize()[link2]
Implementation
static function normalize($string, $form = Normalizer::FORM_C) { return normalizer_normalize($string, $form); }
$tag = Ut::normalize($tag);
Transcoding
\UConverter::transcode($sString, 'UTF-8', 'UTF-8'); // strip bad bytes against attacks
- [link1] https://www.php.net/manual/en/normalizer.normalize.php
- [link2] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize