SimpleXMLElement occasionally fails to parse gb2312 or big5 feeds

SimpleXMLElement occasionally fails to parse gb2312 or big5 feeds

am 02.04.2010 16:28:57 von Peter Pei

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);


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: SimpleXMLElement occasionally fails to parse gb2312 or big5

am 07.04.2010 05:13:58 von Dan Joseph

--0016361e7f34021cd604839cf47b
Content-Type: text/plain; charset=ISO-8859-1

On Fri, Apr 2, 2010 at 10:28 AM, Peter Pei 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

--0016361e7f34021cd604839cf47b--