Are there any best practices for handling encoding issues when extracting data from HTML in PHP?

When extracting data from HTML in PHP, encoding issues can arise due to different character sets used in the HTML document. To handle encoding issues, it is recommended to use functions like `mb_convert_encoding()` to convert the extracted data to the desired encoding.

// Extracting data from HTML with encoding handling
$html = file_get_contents('https://example.com');
$encoded_html = mb_convert_encoding($html, 'UTF-8', 'auto');
// Use $encoded_html for further processing