private static void WriteString(FileStream f, string str, bool quote) { byte[] bytes = Encoding.UTF8.GetBytes((quote ? "\"" : "") + str.Replace("\"", "\\\"") + (quote ? "\"" : "")); f.Write(bytes, 0, bytes.Length); }