简单检测脚本:

import codecs
file_path = '/Users/mac/Downloads/test.xml'

with open(file_path) as source_file:
    data = source_file.read()
    if data[:3] == codecs.BOM_UTF8:
        print('******* Have BOM  *******')
    else:
        print('******* No BOM  *******')