Search code examples
phphtmlfontsunicode-normalization

Remove Strange Font Coding


Hi im hoping this is a simple issue I am loading some simple data via an API however some users have made their username's in fancy fonts as below.

𝓦𝓮𝓫 𝓡𝓮𝓹𝓸𝓼𝓽𝓼

How to do I convert this to a simple standard encoding using PHP so it would display as.

Web Reposts

Thank you


Solution

  • <?php
    echo(Normalizer::normalize("𝓦𝓮𝓫 𝓡𝓮𝓹𝓸𝓼𝓽𝓼", Normalizer::FORM_KC));
    

    (If you want, you can use form KD instead of KC.) See https://secure.php.net/manual/en/class.normalizer.php for more details.