C# create file with utf-8 encoding
Edit
If you want to create a sitemap for your website for SEO on google you need to create a sitemap.txt file with utf-8 encoding, In this post we will write C# code to create a text file with utf-8 encoding.
public ActionResult CreateSitemap()
{
data = GetSiteMap()
System.IO.File.WriteAllText(Server.MapPath("/sitemap.txt"), data, Encoding.UTF8);
return Content("success");
}