[lib] escape keys for autocomplete