Yes there is a method to the madness in the choice I made to use encodeURIcomponent 1dmf. It gets a bit complicated though.
Let's begin with the fact that the three possible choices --escape(), encodeURI(), and encodeURIcomponent()-- all encode different characters and do so at different levels.
escape() was developed to encode Javascript itself, not URI's, so one could say that it's not the best function for the job. It will encode characters that should not be encoded, so is not only overkill but will give you extremely questionable results for some foreign letter characters or any characters that are non-ASCII characters. As a general rule escape() simply eliminates non-ASCII characters that appear in the affected string when used to encode these strings, as opposed to attempting to encode these non-ASCII characters or simply leaving them in there unencoded. In other words, you lose data if you try to send non-ASCII characters through escape(). Try escape encoding something like
Ö for example. (That maps to an Ö character entity or "& #214;" html entity if you scrunch that together or U+006 in Unicode characters) It'll simply disappear when you decode it, even though it's a completely valid letter character that very well may show up in a search on some versions of Google.
I won't even mention that escape() has been deprecated since EMCAScript v3.

Let's just leave it at escape() won't work for the type of user generated input the tool is dealing with.
encodeURI() kind of goes to the other extreme. It assumes the URI is a complete URI, thus does
not encode reserved characters that have a special meaning in a URI. Sounds like a perfect choice then doesn't it? Well, it's not. Using encodeURI() by itself isn't something you can use for proper http GET or POST requests, like are typically used with ajax for xmlhttprequests. Why? Because encodeURI() doesn't encode special characters that are reserved in URI's it doesn't encode characters like "?", "+" and "=". All of which are going to appear in pretty much every single call sent to the GRE ajax routine. If you want to see truly wacky results try this one sometime, because you'll end up with two query strings and the high possibility that variables may end up getting split.
When you're dealing with user defined input it can get very, very nasty very, very quickly. So encodeURI() isn't the right tool for the job either.
So following this logic encodeURIcompenent is really the only choice, not just the best. It encodes exactly the stuff we need to be encoded and doesn't encode the stuff that we don't need or want to be encoded. With the only downside being that older versions of IE had a bug --sort of like they're trying to use the escape() method instead of a real encodeURIcomponent() method.
Bottom line, escape should
not be used to encode http URI's. encodeURI() shouldn't be used if you're going to send the resulting string through an http GET or POST request, including ajax's xmlhttprequest. encodeURIcomponent() is the only tool for the job. It's just too bad IE didn't get their implementation of it right for several years when they were the only game in town. Especially since they said they supported it beginning with IE 5.5.