In toEscapedString, output a single character instead of a string where possible.