Encoding of "dangerous" characters in search input terms.

Also more robust handling of calibration-gathering logic in cases where it's passed an empty or bogus list of IDs.