SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Evangelist
    Join Date
    Apr 2007
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    htmlspecialchars

    Hi All,

    I have a question about my RSS feed. Say I have a non-breaking space in the form   saved in mysql database it crashes the RSS feed when I try and output the data.

    How would it change   to just a plain &

    Would it be using htmlspecialchars? Ie:

    PHP Code:
                $rssValue .= "<title>" htmlspecialchars($row['headline'], ENT_QUOTES) . "</title>\r\n"
    Or is it done using the character encoding ie:

    PHP Code:
    $rssValue  = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\r\n";
    $rssValue .= "<rss version=\"2.0\">\r\n";
    Or have I misunderstood? How would/can it be done?

    Thanks

    Chris

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,290
    Mentioned
    198 Post(s)
    Tagged
    3 Thread(s)

    other entities in RSS feed

    Maybe you're looking for CDATA ?? eg.
    Code XML:
    <description>
    <![CDATA[
    whatever "non-parsed" data you want here.
    ]]>
    </description>

  3. #3
    SitePoint Evangelist
    Join Date
    Apr 2007
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yep, that's the one - thank you!


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
  •