What steps should be taken to ensure proper handling of UTF-8 characters in PHP and HTML files?

When handling UTF-8 characters in PHP and HTML files, it is important to ensure that the proper character encoding is set. This can be done by setting the UTF-8 encoding in both the PHP file and the HTML file using meta tags. Additionally, when working with strings that may contain UTF-8 characters, it is recommended to use functions like mb_convert_encoding() to handle the encoding properly.

<?php
header('Content-Type: text/html; charset=utf-8');
mb_internal_encoding('UTF-8');
mb_http_output('UTF-8');
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<?php
echo "UTF-8 characters: ä, ö, ü";
?>
</body>
</html>