Question

I am trying to pass a parameter value via the URL and it works for most values unless the value contains parenthesis. I have tried the backslash () to escape them but it doesn't appear to work.

Here is the URL

http://<server>/OpenDocument/opendoc/openDocument.aspx?sViewer=html&sDocName=<DocName>&sType=rpt&promptex-<ParamName>=VALUE_CONTAINING_(PARENTHESIS)
Was it helpful?

Solution

I discovered that the value can be enclosed in quotes and then URI-escaped.

The URL becomes

http://<server>/OpenDocument/opendoc/openDocument.aspx?sViewer=html&sDocName=<DocName>&sType=rpt&promptex-<ParamName>=URI_ESCAPE("VALUE_CONTAINING_(PARENTHESIS)")

OTHER TIPS

What you are looking for is URL encoding. Parenthesis will not be your only issue. So for the full answer, I recommend looking at the table available http://www.w3schools.com/tags/ref_urlencode.asp

For your specific answer:
( = %28
) = %29

&promptex-=VALUE_CONTAINING_(PARENTHESIS) becomes &promptex-=VALUE_CONTAINING_%28PARENTHESIS%29

This will then be un-encoded by the servlet engine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top