Quantcast
Viewing all articles
Browse latest Browse all 35

Answer by Luca Ziegler for Is it possible to force Excel recognize UTF-8 CSV files automatically?

Found a solution for ASP.NET Core to download CSV's as UTF8 with POM:

byte[] csvBytes = Encoding.Default.GetBytes(csvString);UTF8Encoding utf8 = new UTF8Encoding(true);byte[] bom = utf8.GetPreamble();var result = bom.Concat(csvBytes).ToArray();return new FileContentResult(result, MediaTypeHeaderValue.Parse("text/csv; charset=utf-8"));

Excel is recognizes the downloaded CSV file than as UTF8.


Viewing all articles
Browse latest Browse all 35

Trending Articles