SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Addict
    Join Date
    Dec 2005
    Posts
    381
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question symbols not appearing correctly in xml RSS feed

    Help Please!!!

    I'm fairly new to xml and rss feeds so I'm sorry if this is an easy thing to fix and I'm just being a bit thick with it.

    I've set up a php script to generate an xml file based on a table in my MySQL database. This works perfectly fine but the problem is that one of the rows in the table contains which won't display correctly in the xml file.
    I know if I put in £ it displays the sign correctly.

    What is the best way for me to get these to display correctky?
    Should I try to do any of the following:
    1. Find and replace all instances of when initially uploading the data to the database
    2. Change the encoding of my xml file
    3. Do a find and replace on the php script that I am using to generate the xml file

    Any help would be much appreciated

  2. #2
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    You should replace any instances of the character with the correct HTML replacement which will work (unrelated to encoding)... £

  3. #3
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,653
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Excepting that won't quite work in XML--you will likely get an "unknown entity." The thought is correct--how are you generating the RSS? Is it being encoded properly or just created as a text string?

  4. #4
    SitePoint Zealot
    Join Date
    Nov 2006
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm having problem to all & symbol from the generated RSS feed.

    <item>
    <title>News of today</title>
    <link>http://mysite.com/index.php?a=1&b=2</link>
    <description>All you need to know about RSS</description>
    </item>

    Thus, the feed cannot be displayed at all unless i remove the &b=2 from the link.

    Do you have any idea to solve this problem?

    Thank you!
    newbie...

  5. #5
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    You should be able to use &amp; in place of & to allow you to use the character on each entry which uses the ampersands

  6. #6
    SitePoint Member
    Join Date
    Apr 2007
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try if encoding "iso-8859-1" works. please let us know what worked.

  7. #7
    SitePoint Zealot
    Join Date
    Nov 2006
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Quote Originally Posted by AlexDawson View Post
    You should be able to use &amp; in place of & to allow you to use the character on each entry which uses the ampersands


    thanks! this is working for the links!
    newbie...

  8. #8
    SitePoint Zealot
    Join Date
    Nov 2006
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kiran7 View Post
    Try if encoding "iso-8859-1" works. please let us know what worked.

    I tested. Without converting the & to &amp; the rss feed is not working as desire...
    newbie...

  9. #9
    SitePoint Zealot
    Join Date
    Nov 2006
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Between, just some sharing here...

    As my content for the description part is user entered text & is pulled from database, it contains some code eg &nbsp;. These codes will caused problem to the rss display and i have to replace all &nbsp; with blank in order to have the rss display correctly.
    newbie...

  10. #10
    SitePoint Zealot
    Join Date
    Nov 2006
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by liyenn View Post
    Between, just some sharing here...

    As my content for the description part is user entered text & is pulled from database, it contains some code eg &nbsp;. These codes will caused problem to the rss display and i have to replace all &nbsp; with blank in order to have the rss display correctly.

    CORRECTION



    I don't get to edit the above post, thus i quoted it and make correction here.

    After further testing, I found that it has nothing to do with the &nbsp;

    The problem is caused by the & symbol in the description. Thus, we have to convert all & to &amp; in order to get the rss display correctly.

    Sorry for the confusion caused.
    newbie...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •