In PHP 7 I used the following code to get DOM Document object from HTML which may contain cyrillic letters:
$pageHTML = '<!doctype html>
<html>
<head>
</head>
<body>
<div>Текст</div>
</body>
</html>';
$pageHTML = mb_convert_encoding($pageHTML, 'HTML-ENTITIES', 'UTF-8');
$dom = new DOMDocument;
$dom->loadHTML($pageHTML);
echo $dom->getElementsByTagName('div')[0]->textContent;
Now, in PHP 8 it throws the error
mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead in ...
What exactly should I use now in PHP 8?