RockLobsterInc\Functions

scrub_utf8() │ CF7 1.0

Replaces ill-formed UTF-8 byte sequences with the Unicode Replacement Character.

Хуков нет.

Возвращает

string. Input text with invalid sequences of bytes replaced with the Unicode replacement character.

Использование

scrub_utf8( $input ): string;
$input(строка) (обязательный)
String which is assumed to be UTF-8 but may contain invalid sequences of bytes.

Код scrub_utf8() CF7 6.2.4.1

function scrub_utf8(string $input): string
{
    $prev_replacement_character = mb_substitute_character();
    mb_substitute_character(0xfffd);
    $scrubbed = mb_scrub($input, "UTF-8");
    mb_substitute_character($prev_replacement_character);
    return $scrubbed;
}