src/Util/Strings.php
public static function fixEncoding(string $s): string
    {
        // removes xD800-xDFFF, x110000 and higher
        return \htmlspecialchars_decode(\htmlspecialchars($s, ENT_NOQUOTES | ENT_IGNORE, 'UTF-8'), ENT_NOQUOTES);
    }
public static function fixEncoding(string $s): string
    {
        // removes xD800-xDFFF, x110000 and higher
        return \htmlspecialchars_decode(\htmlspecialchars($s, ENT_NOQUOTES | ENT_IGNORE, 'UTF-8'), ENT_NOQUOTES);
    }
public static function fixEncoding ( string $ s ) : string { // removes xD800-xDFFF, x110000 and higher return \ htmlspecialchars_decode ( \ htmlspecialchars ( $ s , ENT_NOQUOTES | ENT_IGNORE , 'UTF-8' ) , ENT_NOQUOTES ) ; }
Removes invalid code unit sequences from UTF-8 string.

@param  string $s byte stream to fix

@return string
Removes invalid code unit sequences from UTF - 8 string .