Skip to content
This repository has been archived by the owner on Apr 8, 2020. It is now read-only.

Ampersands have extra space around them #55

Open
joehuggans opened this issue Jan 9, 2020 · 2 comments
Open

Ampersands have extra space around them #55

joehuggans opened this issue Jan 9, 2020 · 2 comments

Comments

@joehuggans
Copy link

joehuggans commented Jan 9, 2020

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
Copy link
Author

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
Copy link
Author

joehuggans commented Jan 11, 2020

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'};

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant