C#: Excel export doesn't show correctly for Myanmar Font data

Viewed 144

I am trying to get datatable data as a CSV file. But the data with Myanmar font doesn't show correctly in excel. It is showing as the following character.

"လမ်း áႠလေးပုံá€á€•ုံ မြို့" I attached my code.

DataTable dt = ToDataTable(objList);
        StringBuilder sb = new StringBuilder();

        IEnumerable<string> columnNames = dt.Columns.Cast<DataColumn>().
                                          Select(column => column.ColumnName);

        sb.AppendLine(string.Join(",", columnNames));

        foreach (DataRow row in dt.Rows)
        {
            IEnumerable<string> fields = row.ItemArray.Select(field => field.ToString());
           
            sb.AppendLine(string.Join(",", fields));
        }
        string folderPath = HttpContext.Current.Server.MapPath("/Files") + "/Files/Export/";
        File.WriteAllText(folderPath + "Export.csv", sb.ToString());
1 Answers
Related