Remove illegal characters for keys