unEscape JavaScript中的JavaScript转义值 [英] unEscape JavaScript escaped value in JAVA
问题描述
在我们的网络服务中,我们通过JavaScript通过Java(Servlet)
设置Cookie,但是我们需要转义cookie的值,因为它可能
是否有一种透明的方式来转义(JavaScript)和再次解析(JAVA)?? / p>
感谢,
Pieter Goddijn
获得 StringEscapeUtils 从 Commons Lang 转义/取消转义。
在Javascript中,您可以通过 encodeURIComponent 转义,但我认为我给你的共享组件将满足你的需要。
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?
thanks, Pieter Goddijn
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.
这篇关于unEscape JavaScript中的JavaScript转义值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!