Raphael.Export icon indicating copy to clipboard operation
Raphael.Export copied to clipboard

Ampersands have extra space around them

Open joehuggans opened this issue 6 years ago • 2 comments

Hi, I've just inherited a project which uses this library, so bare with me.

We have found an issue when adding ampersands, so for instance if my input text is

Joe & Bob's

When looking at the source code of the SVG it is

Joe  &  Bob's

Which creates this double space around the ampersand

joehuggans avatar Jan 09 '20 15:01 joehuggans

Excuse this, I seem to be have using a modified version of raphael.export.js, more than likely a modified version since this library doesn't seem to handle ampersands.

joehuggans avatar Jan 09 '20 15:01 joehuggans

Sorry this does work with ampersands, our issue seems to have been related to spaces in text which were stripped out and were causing ampersands to also be stripped out, I'm not sure why but I fixed it by in the function escapeXML; Adding the an extra item for spaces to the replace object:

var replace = {'&': 'amp', '<': 'lt', '>': 'gt', ' ': '#x00a0'};

joehuggans avatar Jan 11 '20 06:01 joehuggans