How can one change the charset for html_entity_decode in PHP?

When using the html_entity_decode function in PHP, the default character set used is ISO-8859-1. If you need to decode HTML entities using a different character set, you can specify the desired charset as the third parameter in the function. This allows you to decode HTML entities using UTF-8 or any other character set supported by PHP.

// Specify the desired character set as the third parameter in html_entity_decode
$decoded_string = html_entity_decode($encoded_string, ENT_COMPAT, 'UTF-8');