[hobbit] Problem with the rss file
Henrik Stoerner
henrik at hswn.dk
Tue Sep 20 10:48:18 CEST 2005
On Tue, Sep 20, 2005 at 10:30:01AM +0200, Francesco Duranti wrote:
> I've a little problem with the creation of the rss/xml file.
> Sometimes I get errors in it related at some external plugin used with
> some bb client that put character that will distrupt the file.
[snip]
> It seems to me that the & char have to be escaped (or removed) to get it
> work.
Right, does this patch fix it for you ? Against 4.1.1, or any snapshot
you may have.
Regards,
Henrik
-------------- next part --------------
--- bbdisplay/rssgen.c 2005/04/25 12:54:24 1.16
+++ bbdisplay/rssgen.c 2005/09/20 08:45:47
@@ -150,7 +150,26 @@
}
fprintf(fd, "</link>\n");
- if (e->shorttext) fprintf(fd, "<description>%s</description>\n", e->shorttext);
+ if (e->shorttext) {
+ char *inpos = e->shorttext, *amp;
+
+ fprintf(fd, "<description>");
+ /* Must escape any &-characters, or RSS readers will choke on them */
+ while (inpos && *inpos) {
+ amp = strchr(inpos, '&');
+ if (amp) {
+ *amp = '\0';
+ fprintf(fd, "%s&", inpos);
+ *amp = '&';
+ inpos = amp+1;
+ }
+ else {
+ fprintf(fd, "%s", inpos);
+ inpos = NULL;
+ }
+ }
+ fprintf(fd, "</description>\n");
+ }
fprintf(fd, " </item>\n");
}
More information about the Xymon
mailing list