Commit 180c6aaf authored by chenghua's avatar chenghua

Update ini.go

支持BOM格式的ini文件
parent 710f5b62
......@@ -66,6 +66,12 @@ func (ini *IniConfig) Parse(name string) (ConfigContainer, error) {
var comment bytes.Buffer
buf := bufio.NewReader(file)
head, err := buf.Peek(3)
if err == nil && head[0] == 239 && head[1] == 187 && head[2] == 191 {
for i := 1; i <= 3; i++ {
buf.ReadByte()
}
}
section := DEFAULT_SECTION
for {
line, _, err := buf.ReadLine()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment