encode key (except for /)