import os

def strip_bom(filepath):
    with open(filepath, 'rb') as f:
        content = f.read()
    if content.startswith(b'\xef\xbb\xbf'):
        print(f"BOM found in {filepath}. Stripping...")
        with open(filepath, 'wb') as f:
            f.write(content[3:])
        return True
    return False

plugin_dir = r"c:\xampp\htdocs\My website\wp-content\plugins\vendor-space"
for root, dirs, files in os.walk(plugin_dir):
    for file in files:
        if file.endswith('.php'):
            strip_bom(os.path.join(root, file))
