Formatting characters in RSS feed
Posted on 2007-08-09
I'm using the ROME java api to create an RSS feed, and I'm having difficulty with the British Pound symbol.
The originating database entry has the normal pound sign (£). My feedwriter outputs the xml file, but on Unix based servers they don't like it, and it gets converted to something unusable. Looking at other popular rss feeds, such as the BBC, it seems the answer is to format your xml file to use the notation '& - # - 163 - ;' (dashes included in case the formatting is lost here too!). So ampersand, hash, 163, semi-colon.
I have confirmed this works when the feed is loaded into the browser, by editing the xml file by hand. But my problem is actually writing the file. When I do a replaceAll() call on all my pound signs, rather than writing the characters as described above, it converts the ampersand into the HTML equivalent - with the 'amp semi-colon' in it. So I end up with....
&#163; - which means nothing to the browser.
There must be a simple way around this - why is this happening, or what could I do instead?
Hope someone has some clues! Thanks.