[MarkLogic Dev General] Question about xdmp:url-encode

McBeath, Darin W (ELS-STL) D.McBeath at elsevier.com
Fri Dec 10 03:38:16 PST 2010


Good point, I'll take a look at encode-for-uri ... I had forgotten about that XPath function.  That might actually be what I need.


-----Original Message-----
From: general-bounces at developer.marklogic.com on behalf of Sam Neth
Sent: Thu 12/9/2010 11:33 PM
To: General MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Question about xdmp:url-encode
 
You might also just need fn:encode-for-uri, which produces upper case hex digits.  Depending on the source of the data, I might be concerned about the risk of variation in the set of reserved characters though.  I'd probably lean towards comparing to a decoded copy of the string, stored with or in place of the encoded version.  You could decode the data in your XPath instead, but that might get expensive.


Sam Neth
Lead Engineer
MarkLogic Corporation


On Dec 9, 2010, at 9:24 PM, Michael Blakeley wrote:

Darin, have you considered setting a case-insensitive collation? That should work for an XPath expression.

-- Mike

On Dec 9, 2010, at 17:35, "McBeath, Darin W (ELS-STL)" <D.McBeath at elsevier.com<mailto:D.McBeath at elsevier.com>> wrote:


I am using xdmp:url-encode to encode a string.  While it's nice to have the feature to encode a 'space' as either '+' or '%20', I wonder if there is perhaps an undocumented feature to encode for example a '?' as either '%3f' or '%3F'.   MarkLogic seems to have taken the approach of using lower-case characters.  If I read RFC3986, while both lower and uppercase are to be treated as equal,  they suggest for consistency that uppercase characters be used.

In my particular case, I actually have a string stored in a database that has been encoded (with the '%3F' as it was encoded by an outside tool and is stored that way in the DB).  Now, when I want to query against this value, I will not get an exact match (using simple XPath expression) when encoding a passed query string parameter (using MarkLogic xdmp:url-encode).  Of course, I could use cts:search and cts:element-value-query with a (case insensitive compare option), but I was curious if this question/issue has been raised in the past.  Are there any plans to adjust the signature for xdmp:url-encode to support more options?

Thanks.

Darin.
_______________________________________________
General mailing list
General at developer.marklogic.com<mailto:General at developer.marklogic.com>
http://developer.marklogic.com/mailman/listinfo/general

_______________________________________________
General mailing list
General at developer.marklogic.com<mailto:General at developer.marklogic.com>
http://developer.marklogic.com/mailman/listinfo/general




More information about the General mailing list