static string Escape(string foo) { return foo.Replace ("\"", "\\\"").Replace ("\n", "\\n").Replace ("\r", "\\r").Trim (); }