ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Byte Order Mark generated in RSS

July 31, 2007 2:00pm

Subscribe [3]
  • #1 / Jul 31, 2007 2:00pm

    Daman

    10 posts

    Hi,

    The RSS feed from my blog is being consumed by an application within our organization. The XML parser on their end is throwing an error when trying to parse my EE generated RSS Feed.
    The error is due to the Unicode Byte-Order Mark (BOM) being pre-pended to the RSS feed xml. Is there a way to remove or turn off BOM being generated in the RSS feed.

    Would request immediate help as I am on a razor sharp deadline.

    Thanks
    -Daman

  • #2 / Jul 31, 2007 2:10pm

    Lisa Wess

    20502 posts

    Hi, Daman,

    What version and build of EE are you on?  And can you give us a link to the feed?

  • #3 / Jul 31, 2007 2:12pm

    Daman

    10 posts

    I am on version 1.5.2, build 20070302.
    I can’t send a link…the site is not external facing yet…Sorry :(

  • #4 / Jul 31, 2007 2:14pm

    Lisa Wess

    20502 posts

    The first thing I would recommend is updating to 1.6 and see if that helps.  Also, can you post your RSS template, and also make sure it is set to RSS template?

    I’d also recommend taking the rendered source and running it through the Feedvalidator and seeing what it returns.

  • #5 / Jul 31, 2007 2:24pm

    Daman

    10 posts

    Sorry again…but I can’t upload to 1.6…that would involve going through days of red tape.
    Can’t run through feed validator because the blog is on an internal url.
    The RSS template is set to type RSS.

    I’m posting the template here though.

    {assign_variable:master_weblog_name="myblog"}
    {exp:rss:feed weblog="{master_weblog_name}"}
    <?xml version="1.0" encoding="{encoding}"?>
    <rss version="2.0"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
        xmlns:admin="http://webns.net/mvcb/"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns:content="http://purl.org/rss/1.0/modules/content/">
    
        <channel>
        
        <title>{exp:xml_encode}{weblog_name}{/exp:xml_encode}</title>
        <link>{weblog_url}</link>
        <description>{weblog_description}</description>
        <dc:language>{weblog_language}</dc:language>
        <dc:rights>Copyright {gmt_date format="%Y"}</dc:rights>
        <dc:date>{gmt_date format="%Y-%m-
T;%H:%i:%s%Q"}</dc:date>
        <dc:creator>{author}</dc:creator>
        <admin:generatorAgent rdf:resource="http://www.companyname.com/" >
        
    {exp:weblog:entries weblog="{master_weblog_name}" rdf="off" dynamic_start="on" disable="member_data|trackbacks"}
        <item>
          <title>{exp:xml_encode}{title}{/exp:xml_encode}</title>
          <link>{title_permalink={master_weblog_name}/comments/index}</link>
          <guid>{title_permalink={master_weblog_name}/index}#When:{entry_date format="%H:%i:&#xsZ;"}</guid>
          <description>{exp:xml_encode}{body}{/exp:xml_encode}</description>
          <dc:subject>{exp:xml_encode}{categories backspace="1"}{category_name}, {/categories}{/exp:xml_encode}</dc:subject>
          <dc:date>{entry_date format="%Y-%m-
T;%H:%i:%s%Q"}</dc:date>
        </item>
    {/exp:weblog:entries}
        
        </channel>
    </rss>
    
    {/exp:rss:feed}
  • #6 / Jul 31, 2007 2:31pm

    Lisa Wess

    20502 posts

    Can you view the source of the feed and post the problematic area, please?

  • #7 / Jul 31, 2007 3:45pm

    Daman

    10 posts

    Hi,

    I did some more investigation and the problem seems to be absence of the following http header with the RSS feed response

    Transfer-Encoding: chunked

    Since the receiving application does not see this header in the RSS feed, it closes connection before it has received the whole XML and therefore breaks.

    Now ...I am not sure if I can setup EE such that it sends this header for the RSS feed, or if this needs to be resolved within the http server configurations.

    I’m sorry for throwing things at you, but I am discovering things as we talk.

    Thanks

  • #8 / Jul 31, 2007 4:27pm

    Derek Allard

    3168 posts

    Could you post the results of your feed for us?  That might help.  Also, any idea what feed reader they are using to consume?

    You can probably force EE (via PHP) to send the header.  Try enabling PHP for the RSS template and adding

    <?php
    header("Transfer-Encoding: chunked");
    ?>

    to the top of it.

    Let us know if that’s helpful.

  • #9 / Jul 31, 2007 4:57pm

    Daman

    10 posts

    Adding the header did not really help. I do see the header coming with the response, though chunked is completely another transportation mechanism which includes sending delimiters after every chunk of data….so just adding the header does not seem to work :(

    I am guessing this might work if we can somehow include a “Content-Length” header with the RSS response, so that the receiving applications know when to stop reading the data. Is there a way to do that.

    I am also posting below the contents of the header. I’m sorry ...but can’t post the RSS ...not allowed to.

    HTTP/1.1 200 OK
    Server: Netscape-Enterprise/6.0
    Date: Tue, 31 Jul 2007 19:45:16 GMT
    Content-type: text/xml; charset=utf-8
    P3p: CP="UNI DEM GOV FIN STA COM NAV PRE INT ONL CUR ADM DEV PSA PSD CUSi IVDi IVAi TELi CONi TAI OUR OTRi"
    Fsreqid: REQ46af914a0a232c4420005eca0000aa33
    X-powered-by: PHP/5.1.2
    Set-cookie: exp_last_activity=1185925514; expires=Wed, 30-Jul-2008 19:45:14 GMT; path=/
    Expires: Tue, 24 Jul 2007 17:29:03 GMT
    Last-modified: Tue, 24 Jul 2007 16:29:03 GMT
    Cache-control: no-store, no-cache, must-revalidate
    Cache-control: post-check=0, pre-check=0
    Pragma: no-cache
    Connection: close
  • #10 / Jul 31, 2007 5:45pm

    Derek Allard

    3168 posts

    OK, if that didn’t help, you’ll probably need to chat with your host about the appropriate headers to have your site send.  Sorry we can’t help you more on that front.

    Do you know what xml parser the recipient is using?

  • #11 / Jul 31, 2007 7:15pm

    Derek Jones

    7561 posts

    Damon, what is the exact error being output, say, if you view the feed with Firefox?  And instead of

    {assign_variable:master_weblog_name="myblog"}

    Can you please hard code the weblog parameter for both the RSS and weblog entries tags, and eliminate all whitespace in the template before the opening RSS tag?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases