public static function SanitizeUTF8($value)
    {
        if (self::getIsIconvEnabled()) {
            $value = @iconv('UTF-8', 'UTF-8', $value);
            return $value;
        }

        if (self::getIsMbstringEnabled()) {
            $value = mb_convert_encoding($value, 'UTF-8', 'UTF-8');
            return $value;
        }

        // else, no conversion
        return $value;
    }
public static function SanitizeUTF8($value)
    {
        if (self::getIsIconvEnabled()) {
            $value = @iconv('UTF-8', 'UTF-8', $value);
            return $value;
        }

        if (self::getIsMbstringEnabled()) {
            $value = mb_convert_encoding($value, 'UTF-8', 'UTF-8');
            return $value;
        }

        // else, no conversion
        return $value;
    }
public static function SanitizeUTF8 ( $ value ) { if ( self :: getIsIconvEnabled ( ) ) { $ value = @ iconv ( 'UTF-8' , 'UTF-8' , $ value ) ; return $ value ; } if ( self :: getIsMbstringEnabled ( ) ) { $ value = mb_convert_encoding ( $ value , 'UTF-8' , 'UTF-8' ) ; return $ value ; } // else, no conversion return $ value ; }
Try to sanitize UTF8, stripping invalid byte sequences. Not perfect. Does not surrogate characters.

@param string $value
@return string
Try to sanitize UTF8 stripping invalid byte sequences . Not perfect . Does not surrogate characters .