[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [syndication] XML Character encoding (again)
I've switched to iso-8859-1 encoding and the feed now validates (today).
As I hinted earlier, It's a reasonable assumption that the vast majority
of posts are made from Wintel with IE so this might well solve my
problem for 99% of cases.
Another data point. php has a function utf-encode
http://www.php.net/manual/en/function.utf8-encode.php
This might be an alternate solution which I'll explore. Interestingly
there's a comment here in the user contributed notes.
"To write an XML element $title containing "exotic" (eg. non ASCII é & à
ñ...) 2 solutions I found :
Fastest :
$xml .= "<title><![CDATA[" . $title ."]]></title>\n"
or cleanest :
$xml .= "<title>".utf8_encode(htmlspecialchars($title))."</title>\n"
After that, your xml can be parsed without errors."
So my misunderstanding of CDATA and encoding seems to be widespread.
See also http://feeds.archive.org/validator/docs/error/SAXError
--
Julian Bond Email&MSM: julian.bond@voidstar.com
Webmaster: http://www.ecademy.com/
Personal WebLog: http://www.voidstar.com/
CV/Resume: http://www.voidstar.com/cv/
M: +44 (0)77 5907 2173 T: +44 (0)192 0412 433