Trim trailing whitespace.
Build the autocomplete URL differently.