Re: mb_scrub() is affected by mb_substitute_character()
[email protected] (Nick Lockheart) Mon, 05 Aug 2024 10:47:50 -0400
| Newsgroups | php.doc |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 2024-08-05 at 16:39 +0200, Christoph M. Becker wrote: > On 05.08.2024 at 16:01, Nick Lockheart wrote: > > > `mb_substitute_character()` also applies to `mb_scrub()`, but the > > documentation doesn't list `mb_scrub()` as being affected: > > > > https://www.php.net/manual/en/function.mb-substitute-character.php > > Thank you! > > Can you please file a ticket at > <https://github.com/php/doc-en/issues> > about this? > > Christoph > Hi Christoph, Not sure where to bring this up at, but `mb_scrub()` replaces invalid characters with a standard `?`, but really should use the Unicode Substitution Character (`0xFFFD`) by default. Since `mb_substitute_character(0xFFFD);` changes the output of `mb_scrub()` from `?` to `0xFFFD`, it may be that the default substitute character is `?` where it should be `0xFFFD` per https://www.unicode.org/reports/tr36/