Unable to replace special character in Script include and Business Rules

ideamax
Mega Expert

Hello All,
I am facing a problem in xml creation due to special characters. I am creating xml in script include by using parameters from business rule. There are some string which contains special symbol like (&,') .

To replace them with corresponding html name or html code I am using following code :
mystring.replace("&", "&") or mystring.replace("&", "&")

but , When I save this business rule, it changes the above line to
mystring.replace("&", "&");

Please suggest a way or approach to prevent this .

11 REPLIES 11

Thanks.. But the problem here is the response from external source is escaped (special characters) are handled. But when the same is retrieved in service now using


var response = sm.getResponse();




The response xml still has unescaped special characters say like & , > which when being parsed without escaping (converting & as &) is causing issue.




we can script in during processing to replace the special characters but is there way this can be handled without much processing at receiver's end..? kindly advise..


I'm not sure I follow.