changeset 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 21b31e9c20f3
children d6a4cfefafb3
files mercurial/config.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
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