utfbom软件包utfbom实现了BOM(Unicode字节顺序标记)的检测并根据需要删除。
它还可以返回BOM表检测到的编码。
安装go get -u github.com/dimchansky utfbom软件包utfbom实现了BOM(Unicode字节顺序标记)的检测并根据需要删除。
它还可以返回BOM表检测到的编码。
安装go get -u github.com/dimchansky/utfbom示例包main import(“ bytes”“ fmt”“ io / ioutil”“ github.com/dimchansky/utfbom”)func main(){trySkip([] byte(“ \ xEF \ xBB \ xBFhello“))trySkip([] byte(” hello“))} func trySkip(byteData [] byte){fmt.Println(” Input:“,byteData)//仅跳过BOM outpu