using (var fs = File.Create(errorFileName)) { fs.Write(Encoding.Unicode.GetBytes(p.ToArray()), 0, p.Length); }