I just finished the first round of RSS Feeds for Article Depot and I have come across an issue. Sometimes I get errors when the RSS Feed is displayed in IE. This error comes whether I use UTF-8 or ISO for the feed. Here is one displaying properly: http://www.articledepot.co.uk/rss/advertisingnew.xml And here is one that comes across an unrecognized character: http://www.articledepot.co.uk/rss/generalrandom.xml They display correctly in readers but how can I get the display to look correct? (The main site uses UTF-8 and displays no problem)
Hi YSF, You could try adding this to the top of your feed: <!DOCTYPE rss [<!ENTITY % HTMLlat1 PUBLIC "-//W3C//ENTITIES Latin 1 for XHTML//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent">]> Code (markup): It deals with html entities and should fix your internet explorer problems here... I think
I had thought the following function in my feed builder that spits out the xml should care of that: function xmlentities($string) { return htmlentities($string, ENT_QUOTES, 'UTF-8'); Code (markup):
The problem is your dash character (the one following "How to prepare"). Try adding an XML version line to the beginning of the output: <?xml version="1.0" encoding="utf-8" ?> J.D.
I had to replace all the characters with the HTML code in my RSS output like that: function removespecial($str) { $str = str_replace('"', '"', $str); // make clean $str = str_replace(''', "'", $str); $str = str_replace('"', '"', $str); $str = str_replace('³„', 'A', $str); $str = str_replace('³¤', 'a', $str); $str = str_replace('³…', 'A', $str); $str = str_replace('³ð', 'a', $str); $str = str_replace('³–', 'O', $str); $str = str_replace('³¶', 'o', $str); $str = str_replace('³ú', 'U', $str); $str = str_replace('³ø', 'u', $str); $str = str_replace('³ÿ', 'ss', $str); $str = str_replace('³´', 'o', $str); $str = str_replace('—', '-', $str); $str = str_replace('®', '®', $str); $str = str_replace('&', '&', $str); // prevent &str&str; $str = str_replace('&', '&', $str); return $str; } Code (markup): it works fine now.
Not RSS version, XML version. I saved your feed and I don't get this error in IE with the version line I quoted. J.D.
Ok, I figured it out. The dash in your text is x96 (in hexadecimal), which is the default encoding for the – (a long dash) character (U+2013) in Windows 1252 character set (this is probably where your feed is coming from). What you need to do is to encode this string in UTF-8 (e.g. try using utf8_encode). In general, though, you will need to know the encoding of your source, because some conversions may not work without some additional work (e.g. x96 in some other character set may mean a different thing - e.g. in ISO-8859-1). J.D.