1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-25 22:11:29 +00:00

Update ini.go

支持BOM格式的ini文件
This commit is contained in:
chenghua 2014-10-24 13:45:00 +08:00
parent 710f5b6234
commit 180c6aafac

View File

@ -66,6 +66,12 @@ func (ini *IniConfig) Parse(name string) (ConfigContainer, error) {
var comment bytes.Buffer var comment bytes.Buffer
buf := bufio.NewReader(file) 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 section := DEFAULT_SECTION
for { for {
line, _, err := buf.ReadLine() line, _, err := buf.ReadLine()