def bytes_to_index(lead, tail):
    """ Map a pair of ShiftJIS bytes to the WHATWG index.
    """
    lead_offset = 0x81 if lead < 0xA0 else 0xC1
    tail_offset = 0x40 if tail < 0x7F else 0x41
    return (lead - lead_offset) * 188 + tail - tail_offset