This happens when you have a character set (aka “character encoding”) mismatch between SimplePie's output and the settings for your page.
By default, SimplePie outputs everything as UTF-8. To avoid display issues, you should also ensure that your web page is set to display as UTF-8. We chose UTF-8 as a default because it is a character set that contains a large number of characters from a variety of writing systems (Roman, Japanese, Chinese, Korean, Arabic, Hebrew, etc.)
It's important that your page and SimplePie's content have the same settings, regardless of what they are. It is preferred and highly recommended that you ensure that your page is set to use UTF-8. There are three ways to fix this issue:
- Set a
<meta>tag inside the
<head>section of your page that looks like the following:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
This should only be used by people who understand the potential drawbacks of not using a Unicode-based character set. If this sounds like gibberish to you, don't use this method. This is not the recommended solution because of potential complexities.
- Change SimplePie's output settings to match those of your page using set_output_encoding() in conjunction with handle_content_type(). For example, if your page is set to use
Windows-1252and you want to maintain that, you can set SimplePie to output content as
Windows-1252as well. See the set_output_encoding() documentation page for usage details.
faq/i_m_seeing_weird_characters.txt · Last modified: 2011/03/05 19:56 (external edit)