There are two layers here.
A percent sign has special meaning in a URL, so it must be escaped with
%25
.If you are inserting this value into a tag as HTML, you must use
&
for ampersand. If on the other hand, you are doing this with Javascript (e.g.element.setAttribute('href', 'foo?bar1&bar2')
), then you don't need this.