180c6aaf by chenghua

Update ini.go

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