don't read whole file to detect encoding

pull/240/head
Spencer Young 5 years ago
parent 10daf4c45f
commit d60e9fd0f6

@ -31,7 +31,7 @@ from yamllint.linter import PROBLEM_LEVELS
def determine_encoding(file):
with io.open(file, 'rb') as raw_file:
data = raw_file.read()
data = raw_file.read(4)
if data.startswith(codecs.BOM_UTF16_LE):
encoding = 'utf-16-le'
elif data.startswith(codecs.BOM_UTF16_BE):

Loading…
Cancel
Save