config: discard UTF-8 BOM if found
authorMatt Mackall <mpm@selenic.com>
Tue, 03 Apr 2012 11:35:04 -0500
changeset 16348 f350021ee32e
parent 16347 21b31e9c20f3
child 16351 d6a4cfefafb3
config: discard UTF-8 BOM if found
mercurial/config.py
--- a/mercurial/config.py	Mon Apr 02 17:02:50 2012 -0500
+++ b/mercurial/config.py	Tue Apr 03 11:35:04 2012 -0500
@@ -115,6 +115,9 @@
 
         for l in data.splitlines(True):
             line += 1
+            if line == 1 and l.startswith('\xef\xbb\xbf'):
+                # Someone set us up the BOM
+                l = l[3:]
             if cont:
                 if commentre.match(l):
                     continue