text: public static string EscapeWhitespace(string s, bool escapeSpaces){StringBuilder buf = new StringBuilder();foreach (char c in s.ToCharArray()){if (c == ' ' && escapeSpaces){buf.Append('\u00B7');}else{if (c == '\t'){buf.Append("\\t");}else{if (c == '\n'){buf.Append("\\n");}else{if (c == '\r'){buf.Append("\\r");}else{buf.Append(c);}}}}}return buf.ToString();}