Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encodeSpecialChars ignore attribute feature #46

Open
boggsey opened this issue Feb 4, 2016 · 1 comment
Open

encodeSpecialChars ignore attribute feature #46

boggsey opened this issue Feb 4, 2016 · 1 comment

Comments

@boggsey
Copy link

boggsey commented Feb 4, 2016

I ran into a problem recently with encodeSpecialChars, attributes and ExactTarget. I have a Spanish language email that needs to be encoded, so encodeSpecialChars is a big help. Unfortunately for me, encodeSpecialChars encodes the entirety of special characters. This behavior is problematic because it includes ampersands in href attribute values. I didn't think it would be a problem until I ran a few emails that contained multiple &s and anchor links referencing a section within a page. When this email is sent, ExactTarget replaces each url with it's url forwarding tracking magic and some parameters get lost in the sauce. This does not happen when ampersands are not encoded in the href attribute.

I'm thinking that it might make sense to include an ignore attributes or ignore specific attributes option for encodeSpecialChars, because I don't necessarily need to not encode all ampersands. I know this is partly an ExactTarget problem and might be a pretty extreme edge case, but it has become a pretty consistent issue for me. I'm probably going to fork the repo and try to fix it soon. It just depends on how many Spanish emails I have to code. Just wanted to make you aware.

@jeremypeter
Copy link
Contributor

Underneath we use https://github.com/hughsk/special-html. I think the best thing would be to convert the & back to their decoded form using something like grunt-replace and using the pattern:

{
  match: /&/g,
  replacement: '&'
}

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

No branches or pull requests

2 participants