XJS: How to remove special characters in email in xml string

I'm making a call to a web service where it returns the email with special characters ‡
It does not always return ‡, sometimes it's others and I won't know.

I have the following xml string where I want to clean up the email

var  strResponse = '<Body><PaxRS><ItineraryRef ID="XBHGGE"/><TravelRS><Travel><CustomerInfo><PersonName><Email>‡JOHNDOE@AOL.COM‡1.1</Email></PersonName></CustomerInfo></Travel></TravelRS></PaxRS></Body>';


I want to be able to clean up the email of any special characters that exist, how can I do this in xjs if i don't know the exact special characters that the web service would be returning?

I tried doing this with xslt and though it would strip out the special characters, within the actual platform I'm using it would not remove it, so I want to remove it via javascript instead.

Please advise.
badtz7229Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

zephyr_hex (Megan)DeveloperCommented:
You can achieve this by removing any non-ASCII characters.

strResponse.replace(/[^\x00-\x7F]/g, "");

Open in new window


Fiddle Demo: https://jsfiddle.net/zephyr_hex/tfz7deds/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
badtz7229Author Commented:
thank you. that worked.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.