How can the issue of special characters not being displayed correctly, such as the umlaut "ü" turning into a question mark, be resolved in PHP?

Special characters not being displayed correctly in PHP, such as the umlaut "ü" turning into a question mark, can be resolved by setting the correct character encoding in the PHP file. This can be done by adding a meta tag in the HTML header or using the header() function in PHP to set the content type to UTF-8.

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