Bug + required code changes to fix:
Problem Description:
In de.nava.informa.exporters.RSS_2_0_Exporter,
RSS_1_0_Exporter and RSS_0_91_Exporter, there is a
bug whereby the encoding that was set during
construction is not applied to the output, resulting in an
output that is often considered invalid by IE and RSS
readers like RSS Bandit.
In the method
public void write(ChannelIF channel) throws
IOException
the code currently reads:
XMLOutputter outputter = new XMLOutputter
(Format.getPrettyFormat());
but it should actually read:
Format format = Format.getPrettyFormat();
format.setEncoding(encoding);
XMLOutputter outputter = new XMLOutputter
(format);
This is likely to fix the issue raised in
http://sourceforge.net/tracker/?
group_id=52620&atid=467483&func=detail&aid=1172358
It's not just Spain that suffers - I found that anything
including a "Ł" also suffered, which therefore includes a
lot of UK newsfeeds.
Note: Ideally, these 3 modules should be opened up a
bit to make the creation of derrived classes easier - at
present, everything is private or one monolithic public
method, which doesn't leave much room for
customisation. In order to create a bugfixed version of
this class, one basically has to take a copy of the code
and create a new class, rather than inheriting from the
old.
I've attached a fixed version of the RSS_2_0_Exporter
class. It should be trivial to do likewise for the 1_0 and
0_91 versions. These changes were made by editing
the source from Informa 0.6.0, in which
RSS_2_0_Exporter.java was version 1.3.
Fixed version of RSS_2_0_Exporter
Logged In: YES
user_id=380878
Thanks, Peter, for sending in your patch. I will integrate
it to be part of the next informa release.
Greetings, Niko
Logged In: YES
user_id=1351944
Shortly after posting that bugfix, I found that you'd fixed the
original bug in the CVS version. However, in the project I'm
working on at present, I found the current exporter
functionality a bit limited, so I adapted & refactored the code
a bit, pulling out code that was common to all three exporters
into a common abstract base class, and making it easier to
subclass the whole thing.
If you're going to do a code change, I'd suggest you take
my "new improved" version (you'd have to change the
package names back & remove my CVS headers tho').
Regards, Peter
Refactored code - .zip containing 4 .java files.