Filtering the_title_rss: show me the whitespace!

Before I decided that the only workable solution to my silent data loss problem was that we would all make the switch to Atom, now, I was trying to find a middle ground that would please the contradictory desires of both the feedvalidator and every RSS consuming application on earth by writing a WordPress plugin that would do some escaping by adding a filter for the_title_rss. Yeah. Me? Plugin? You know that’ll descend quickly into tears and broken household objects.

WordPress filter plugins are simple enough: a hot comment with some metadata for the plugin manager, a function that does what you want, and a call to add_filter(). But when I enabled it and refreshed my feed in Firefox, there was a small explosion and fire, followed by an error message claiming it wasn’t properly gzipped. Once I disabled compression, the explosion was due to a well-formedness error resulting from a blank line before the <?xml...> declaration. The bug database tells me that it’s my fault, for having some extraneous whitespace, so could someone help me out and show me the whitespace in that? I did actually try collapsing the comment as well, so it’s all a single line, but although that breaks the hot comment parser, it still outputs the stray newline, almost like it’s not really my fault.

I will not leave trailing newlines after PHP end delimiters. × 1000.


Comment by skippy #
2005-11-08 09:04:00

Looks to me like there’s an extra space at the end of the file, not the beginning. This too makes PHP angry.

Comment by skippy #
2005-11-08 09:05:37

Addendum: I’ve removed the trailing whitespace, and activated the plugin on my blog. Nothing seems to have broken.

Comment by Phil Ringnalda #
2005-11-08 09:27:33