Question

I have an RSS 2.0 Item element which requires a link for the RSS to validate. I want to insert a URI within the link element to link to a page on my website. Within this URI I used & instead of & to separate the different parameters I pass through the URI. When I do this the RSS is able to be validated, however when I copy and paste the URI within the link element into the browser, the browser does not convert it into an & to denote the separation of the URI parameters.

The XML encoding I use is UTF-8.

The URI which I use is:

http://www.stacks.co.uk/rapmusic/albums.php?echonest_id=ARD5VN51187B9B8D29&deezer_id=3505&artist_name=Jamie+Foxx&artist_image=http%3A%2F%2Fuserserve-ak.last.fm%2Fserve%2F_%2F95148.jpg

I also tried to use %26 instead of & but even that did not allow me to go to my URI.

Was it helpful?

Solution

In order not to break the RSS XML, you will always need to use & rather than & in URLs with parameters. When the RSS is rendered for feeds, it will automatically convert the ASCII symbol to a usable URL equivalent; i.e. this:

http://example.com/script.php?param1=foo&param2=bar

Will become:

http://example.com/script.php?param1=foo&param2=bar

If you look at the actual XML, however, it will still show the decoded values - so don't let it fool you. I had the same issue a month or so ago.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top