You want to make sure that browsers correctly handle the UTF-8–encoded text that your programs emit.
Set PHP’s default_encoding configuration directive to utf-8. This ensures that the Content-Type header PHP emits on HTML responses includes the charset=utf-8 piece, which tells web browsers to interpret the page contents as UTF-8 encoded.
Setting default_encoding gives web browsers a heads-up that your page contents should be interpreted as UTF-8 encoded.
However, you still have the responsibility of making sure that the page contents really are properly UTF-8 encoded by using string functions appropriately.
If you can’t change the default_encoding configuration directive, send the Content-Type header yourself with the header() function, as shown in Example 19-9.
Example 19-9. Setting character encoding