replace deprecated function utf8_encode (#1198)

utf8_encode is deprecated since PHP 8.2.0
This commit is contained in:
Fabian Welzer
2023-11-08 10:27:04 +01:00
committed by GitHub
parent a59aaa3dc9
commit dd61302445

View File

@@ -64,7 +64,7 @@ class IdnaWrapper
*/ */
public function encode(string $to_encode): string public function encode(string $to_encode): string
{ {
$to_encode = $this->isUtf8($to_encode) ? $to_encode : utf8_encode($to_encode); $to_encode = $this->isUtf8($to_encode) ? $to_encode : mb_convert_encoding($to_encode, 'UTF-8');
try { try {
return $this->idna_converter->encode($to_encode); return $this->idna_converter->encode($to_encode);
} catch (InvalidArgumentException $iae) { } catch (InvalidArgumentException $iae) {