Replace the deprecated HTML-ENTITIES conversion for PHP 8.2
html_to_dom_document() used mb_convert_encoding() with the HTML-ENTITIES
pseudo-encoding, which is deprecated as of PHP 8.2. Encode non-ASCII
characters with mb_encode_numericentity() instead. The resulting DOM is
identical, including invalid byte sequences being dropped.
Also stop passing an empty string to loadHTML(), which throws a
ValueError as of PHP 8.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>