What are the key areas to check for ensuring proper handling of UTF-8 encoding in a PHP script?

When working with UTF-8 encoding in PHP scripts, it is important to ensure that the script is properly configured to handle Unicode characters. Key areas to check include setting the correct character encoding in the HTML output, using the mbstring functions for string manipulation, and ensuring that data is properly sanitized and validated to prevent encoding issues.

// Set the character encoding for HTML output
header('Content-Type: text/html; charset=utf-8');

// Use mbstring functions for string manipulation
mb_internal_encoding('UTF-8');

// Example of sanitizing input data
$input = $_POST['input'];
$sanitized_input = filter_var($input, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH);