rewrite illegalCharacters