pvgoddijn pvgoddijn - 1 year ago 103
Java Question

unEscape JavaScript escaped value in JAVA

in our web service we set a cookie through JavaScript wich we read again in Java (Servlet)

however we need to escape the value of the cookie because it may contain illegal characters such as '&' which messes up the cookie.

is there a transparent way to escape (JavaScript) and unescape again (JAVA) for this?

Pieter Goddijn

Answer Source

In java you got StringEscapeUtils from Commons Lang to escape/unescape.

In Javascript you escape through encodeURIComponent, but I think the Commons component I gave to you will satisfy your needs.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download