Skip to content

Commit

Permalink
Fix #20
Browse files Browse the repository at this point in the history
  • Loading branch information
unknwon committed Nov 5, 2014
1 parent 4fff07b commit cf81acd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions read.go
Expand Up @@ -31,6 +31,14 @@ import (
func (c *ConfigFile) read(reader io.Reader) (err error) {
buf := bufio.NewReader(reader)

// Handle BOM-UTF8.
// http://en.wikipedia.org/wiki/Byte_order_mark#Representations_of_byte_order_marks_by_encoding
mask, err := buf.Peek(3)
if err == nil && len(mask) >= 3 &&
mask[0] == 239 && mask[1] == 187 && mask[2] == 191 {
buf.Read(mask)
}

count := 1 // Counter for auto increment.
// Current section name.
section := DEFAULT_SECTION
Expand Down
2 changes: 1 addition & 1 deletion testdata/conf.ini
@@ -1,4 +1,4 @@
; Google
; Google
google = www.google.com
search = http://%(google)s

Expand Down

0 comments on commit cf81acd

Please sign in to comment.