What are the best practices for setting the character encoding in PHP scripts to handle special characters like umlauts?

Special characters like umlauts can be properly handled in PHP scripts by setting the character encoding to UTF-8. This ensures that the script can correctly interpret and display these characters. To set the character encoding in PHP, you can use the header() function to send the appropriate Content-Type header with the charset parameter set to UTF-8.

<?php
header('Content-Type: text/html; charset=UTF-8');
?>