Handle spl char in selector

Hello,
I have dynamic selector=aaname="+ word +"

where word might conatin &,'s etc.
but selector accepts it as abc&amp (example)
How to resolve this

You can use as follows:

‘abc*amp’

word.replace("&","&amp").replace("'s",“apos;s”)
this is better?
are these only two char that get converted?

Could you please post your full selector captured by UiExplorer. It would be easy to guide.
&amp is a concatenation of next variable in HTML URL. So, with our breaking the association we can suggest in a best way… if you could able to post your selector hear…

similar to this

myStringVariable = myStringVariable.Replace(reservedCharacter, escapeSequence)

I am not getting reserbedchar…

“<webctrl aaname=’” + myStringVariable + “’ tag=‘INPUT’ />”

In this above selector if myStringVariable = “abc&amp”
then use
myStringVariable = myStringVariable.Replace("&",""").toString
Then your String will contain
myStringVariable --> “abcamp”

But make sure with out & symbol your URL may broke.