If server work as RFC 2109 (from RFC 2068). ( and ) characters in http header (also cookie value) are invalid
If send cookie value has ( or ) to tomcat 7.x. the value was cut before ( or ).
the reason was this code block.
So i suggest to add the line
value = value.replace(/[\(\)]/g, escape);