If you have come across the cursed ‘Invalid Character‘ error while using PHP’s XML or JSON parser then you may be interested in this.
Continue reading “Remove non-UTF8 characters from string with PHP”
We encode our polls in UTF8 so all sites will be able to render them. But there was an issue with our polls at one stage, when the poll dynamically loaded content into the site, like after a vote, the text in the poll would render all screwed up.
The encoding problem occurred due to a site using another character encoding type other than UTF8. The HTML we send is encoded in UTF8 and the first time the poll widget loaded, it renders and looks fine. But it appeared that after a vote, so another request for HTML, the HTML seemed to adopt the sites encoding, causing the text in the poll to look a mess.
So something like…
Here’s a decent description of the problem.