Saturday, May 11, 2024
 Popular · Latest · Hot · Upcoming
105
rated 0 times [  107] [ 2]  / answers: 1 / hits: 15631  / 15 Years ago, tue, may 19, 2009, 12:00:00

In our web service we set a cookie through JavaScript which 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?


More From » java

 Answers
41

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.


[#99504] Thursday, May 14, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
marinalyssak

Total Points: 637
Total Questions: 101
Total Answers: 94

Location: Morocco
Member since Fri, May 22, 2020
4 Years ago
;