写入 `csv` 文件编码头标识格式以避免中文乱码

pull/277/head
千橘 雫霞 4 years ago
parent c54fb92537
commit d2eb422d86
No known key found for this signature in database
GPG Key ID: 8C478C263854EFAA

@ -75,7 +75,8 @@ func ExportCsv(data []CloudflareIPData) {
return
}
defer fp.Close()
w := csv.NewWriter(fp) //创建一个新的写入文件流
_, _ = fp.Write([]byte{0xef, 0xbb, 0xbf}) // UTF-8 BOM 头
w := csv.NewWriter(fp) // 创建一个新的写入文件流
_ = w.Write([]string{"IP 地址", "已发送", "已接收", "丢包率", "平均延迟", "下载速度 (MB/s)"})
_ = w.WriteAll(convertToString(data))
w.Flush()

Loading…
Cancel
Save