I am using XMLReader, more specifically, Jeremy Johnstone's plist processer to process a plist XML file. Some of the strings in the XML file contain special characters. One example is "Frédéric Chopin". When I try to print strings with special characters, they are not being displayed correctly. For example, "Frédéric Chopin" is shown as "Frédéric Chopin" instead.
What can I do so the string is displayed as "Frédéric Chopin"? Thanks!
That looks like a UTF-8 string misinterpreted as some other encoding. You can use iconv()
or mb_convert_encoding()
to convert into whatever your site uses. I recommend the second one since it can generate HTML entities:
<?php
echo mb_convert_encoding($input, 'HTML-ENTITIES', 'UTF-8');