19.11.1. ProblemYou want to make sure that browsers correctly handle the UTF-8-encoded text that your programs emit. 19.11.2. SolutionSet 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. 19.11.3. DiscussionSetting 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 to make sure that the page contents really are properly UTF-8 encoded by using string functions appropriately. 19.13 details how to do that. If you can't change the default_encoding configuration directive, send the proper Content-Type header yourself with the header( ) function, as shown in Example 19-25. Setting character encoding
19.11.4. See Also19.13 for information on generating UTF-8-encoded text. |