PHP.nl

mb_scrub

mb_scrub

Replace ill-formed byte sequences with the substitute character

string **mb_scrub** string $string  $encoding

Perform a character set conversion from the specified encoding, or the default encoding if no encoding was specified, to the same encoding. This has the effect of replacing any invalid byte sequences with the substitute character.

stringThe input string.

encoding The encoding used to interpret . If it is omitted or null, the

  will be used if set, otherwise the 
  will be used.
 `string`mbstring.internal_encoding settingdefault_charset setting

The string result with invalid byte sequences replaced.