Posted March 6, 2007 at 8:26 AM by Ben Nadel
Lastly, the encodeURIComponent() method should be used in most cases when encoding a single component of a URI. This method will encode certain chars that would normally be recognized as special chars for URIs so that many components may be included. Note that this method does not encode the ' character, as it is a valid character within URIs.
This seems to do the trick. Sweet-ass find!