Question

I'm trying to find what the urlencoded value of an asterisk would be. This is not for a URL, though, so please bear with me while I explain.

The background: I'm working with a really old copy of Velocity (in Clickability), and I'm trying to build a search string to pass to solr, where * is a reserved character.

My problem is (and I'm not sure if this is a Clickability thing or velocity specific) when I use the replacement function with "\*" as the 'replace the * with this' parameter, it freaks out, and I have to use single quotes around the string (so I end up with '\*'). I wouldn't have thought twice about this being an issue, but none of the replacements that use single quotes around them actually get triggered.

So my solution until vendor support gets back to me is to urlencode everything, including special characters, and do replacements on the encoded strings. So instead of : getting replaced with \:, I'm replacing %3A with %5C%3A. Then when I'm done with all that, I'm decoding it and passing it to Solr.

However I can't find what the % symbols are for the *. Can someone help me out or point me in the right direction?

Thanks! --Lisa

Was it helpful?

Solution

It's character 42 (decimal) or 2A (hex), so %2A ought to do it.

EDIT: For future reference, there's a list here: http://www.w3schools.com/tags/ref_urlencode.asp

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