🎨 Improve export CSV

This commit is contained in:
Daniel 2024-01-12 10:00:42 +08:00
parent 1f8c651dc4
commit 6cb6161608
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -93,8 +93,13 @@ func ExportAv2CSV(avID string) (zipPath string, err error) {
return
}
writer := csv.NewWriter(f)
if _, err = f.WriteString("\xEF\xBB\xBF"); nil != err { // 写入 UTF-8 BOM避免使用 Microsoft Excel 打开乱码
logging.LogErrorf("write UTF-8 BOM to [%s] failed: %s", csvPath, err)
f.Close()
return
}
writer := csv.NewWriter(f)
var header []string
for _, col := range table.Columns {
header = append(header, col.Name)