forked from baron/baron-sso
fix(backend): add UTF-8 BOM to CSV export for Excel compatibility
This commit is contained in:
@@ -615,9 +615,12 @@ func (h *UserHandler) ExportUsersCSV(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
// 3. Set CSV Headers
|
||||
c.Set("Content-Type", "text/csv")
|
||||
c.Set("Content-Type", "text/csv; charset=utf-8")
|
||||
c.Set("Content-Disposition", "attachment; filename=users_export_"+time.Now().Format("20060102")+".csv")
|
||||
|
||||
// [New] Write UTF-8 BOM for Excel compatibility
|
||||
_, _ = c.Write([]byte{0xEF, 0xBB, 0xBF})
|
||||
|
||||
writer := csv.NewWriter(c)
|
||||
defer writer.Flush()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user