def strip_byte_order_mark(text):
    """Return text with byte order mark (BOM) removed."""
    try:
        return text.encode('utf-8').decode('utf-8-sig')
    except UnicodeError:
        return text