bjjb / ebayr

A small library to help using the eBay Trading API with Ruby
MIT License
60 stars 49 forks source link

listing fails if the title attribute has an ampersand (&) on it. #29

Open Wulfshade opened 5 years ago

Wulfshade commented 5 years ago

Hi,

I've been using this gem for the past two years and never had an issue I could not solve,... until now.

I'm trying to create listings where the title has the ampersand character and it fails with the response error message: nested exception is: \n\torg.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference."

I have tried everything I can think of to escape the "&" but it always fails with the same error.

Here is the title of the listing I've been using to try and sort out the problem: "Black & Decker Vacuum Cleaner Carpet Upholstery tapestry Tool Attachment"

I have tried all of the following: title.gsub("&", "&") title.gsub("&", "\&") title.gsub("&", "%26")

Tried with .encode('utf-8') before the gsub, after the gsub, tried without the encode, etc

Am I missing something obvious here? Any help will be greatly appreciated as I'm running out of ideas.