Jump to content

XML Feed and Stripping Characters


dswain

Recommended Posts

Hey everyone. I'm pretty new here, and I'm fairly new to PHP in general, so I'm totally open to whatever you guys have to suggest. Anyway, here's what I'm trying to work on today:

 

I have an RSS feed and I'm using PHP to output it onto my website. I have most of what I want working, except for one issue: http://swainnet.zapto.org/rss.php if you look here, you'll see that it shows that strange "–" character: in the XML, it looks as if it's suppose to be a dash. I tried to change the encoding of the XML parser trying something like this:

 

<?php
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8");
xml_set_element_handler($parser,"startTag","endTag");
xml_set_character_data_handler($parser,"readTag");?>

 

And I've set that to a variety of things (like US-ASCII, ISO-8859-1) but these changes had no effect. I also tried to strip the dash out with a strrpos and trim, but it seems to be acting like the character doesn't exist within the string. I also tried search for the strange character using strrpos, but it can't seem to find that either. Are there any ideas on what I may be doing wrong or what else I should look for? Thanks in advanced everyone.

 

Oh and my code can be found here (if needed): http://swainnet.zapto.org/rss.txt

Link to comment
Share on other sites

Hm, no, I didn't. I just tried it now. I believe I have the syntax correct:

 

$parser = xml_parser_create('UTF-8');

but that does not seem to have an effect either. I also tried to just leave it quoted (with no actual argument) and no luck with that either.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.