Fix PHP 8.0 ValueError calling mb_convert_encoding() with an invalid encoding
Per https://www.php.net/manual/en/function.mb-convert-encoding.php, as of PHP 8.0.0, a ValueError is thrown if the value of to_encoding or from_encoding is an invalid encoding but a ValueError is not suppressed by the stfu operator ("@").
Origin of the function:
Premising that Arcanist elevates warnings to exception, now we just try-catch.
- enter a valid encoding, such as "7bit", successfully changed encoding
- enter a valid encoding with random capitalization, such as "7biT", successfully changed encoding
- enter a valid alias encoding, such as "ISO-10646-UCS-2", successfully changed encoding
- enter a valid alias encoding with random capitalization, such as "isO-10646-uCS-2", successfully changed encoding
- enter an invalid encoding, such as "whatever", get error message "Repository encoding "whatever" is not valid: String conversion from encoding 'UTF-8' to encoding 'whatever' failed: mb_convert_encoding(): Argument #2 ($to_encoding) must be a valid encoding, "whatever" given"
In any case, no exception is shown anymore.
Reviewers: O1 Blessed Committers, valerio.bozzolan, speck
Reviewed By: O1 Blessed Committers, valerio.bozzolan, speck
Subscribers: 0, speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15423
Differential Revision: https://we.phorge.it/D25249