Re: SimpleXMLElement occasionally fails to parse gb2312 or big5 feeds

From: Date: Wed, 07 Apr 2010 03:13:58 +0000
Subject: Re: SimpleXMLElement occasionally fails to parse gb2312 or big5 feeds
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-303864@lists.php.net to get a copy of this message
On Fri, Apr 2, 2010 at 10:28 AM, Peter Pei <peterpeiguo@hotmail.com> wrote: > > I use the following code to get rss and parse it, but the code occasionally > have issues with gb2312 or big-5 encoded feeds, and fails to parse them. > However other times may appear just okay. Any thoughts? Maybe > SimpleXMLElement is simply not meant for other language encodings... > > $page = file_get_contents($rss); > try { > $feed = new SimpleXMLElement($page); > > > I've been learning a bit about SimpleXML today myself. It seems that it misses a lot of things when it comes to complex, or abnormal XML. Abnormal being what you're describing and whatnot. I don't really have a solid answer for you (Just noticed no one responded), but I think you're running into what I was... Its just built to be Simple, not expand its mind. Hope that helps! -- -Dan Joseph www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month. Promo Code "NEWTHINGS" for 10% off initial order http://www.facebook.com/canishosting http://www.facebook.com/originalpoetry

« previous php.general (#303864) next »