[MarkLogic Dev General] characters transformed into URL code in browser address bar

Jason Hunter jhunter at marklogic.com
Thu Feb 19 12:02:53 PST 2009


> Upon submission of the form...
>
> <form action="test.xqy" method="get">
>  <input type="hidden" name="x" value="one:two" />
>  <input type="submit" value="Submit" />
> </form>
>
> ...the url in the browser address bar becomes...
>
> http://host.com:8008/test.xqy?x=one%3Atwo

That's correct, because %3A is the URL encoded value of a colon.  The  
browser is URL encoding the form value for you.

> If I type http://host.com:8008/test.xqy?x=one:two directly into the  
> address bar, everything works as expected.

Technically you should be using %3A.  The browser is forgiving you  
your transgression and internally sending %3A to the server while  
letting you see the colon.  A less forgiving browser would error out  
saying you had entered a malformed URL.

>  What part of MarkLogic is causing this transformation into URL code  
> (http://www.dualunit.ch/en/tools/cp1252-characters/), and can it be  
> avoided?

This all happens external to MarkLogic Server.  MarkLogic is receiving  
the URL from the browser with the %3A URL encoding in both cases.   
It's decoding it to a colon for you when you call xdmp:get-request- 
field().

> (It's ugly.  I'll admit I'm just being vain, though.)

Yes, it's ugly.  But it's the way of the web.  :)  See RFC 1738 for  
details.

-jh-



More information about the General mailing list