diff mercurial/config.py @ 16348:f350021ee32e

config: discard UTF-8 BOM if found
author Matt Mackall <mpm@selenic.com>
date Tue, 03 Apr 2012 11:35:04 -0500
parents 69e792cf7851
children a6543fdcf869
line wrap: on
line diff
--- 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