From 9e4846b4f0f1a248b9b05962d3081c607378dc6d Mon Sep 17 00:00:00 2001 From: fang duan Date: Wed, 19 Jun 2019 20:02:44 +0800 Subject: [PATCH] Add UTF-8 BOM Add UTF-8 BOM for the chinese csv file --- sqltocsv.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sqltocsv.go b/sqltocsv.go index aca1c7e..93d2a38 100644 --- a/sqltocsv.go +++ b/sqltocsv.go @@ -77,6 +77,8 @@ func (c Converter) WriteString() (string, error) { // WriteFile writes the CSV to the filename specified, return an error if problem func (c Converter) WriteFile(csvFileName string) error { f, err := os.Create(csvFileName) + bomUtf8 := []byte{0xEF, 0xBB, 0xBF} + f.Write(bomUtf8) if err != nil { return err }