import codecs

from .. import codec, incremental

ANSEL_TO_UNICODE_CONTROL = {
    0x00: "\u0000",  # NULL CHARACTER
    0x01: "\u0001",  # START OF HEADING
    0x02: "\u0002",  # START OF TEXT
    0x03: "\u0003",  # END-OF-TEXT CHARACTER
    0x04: "\u0004",  # END-OF-TRANSMISSION CHARACTER
    0x05: "\u0005",  # ENQUIRY CHARACTER
    0x06: "\u0006",  # ACKNOWLEDGE CHARACTER
    0x07: "\u0007",  # BELL CHARACTER
    0x08: "\u0008",  # BACKSPACE
    0x09: "\u0009",  # HORIZONTAL TAB
    0x0A: "\u000A",  # LINE FEED
    0x0B: "\u000B",  # VERTICAL TAB
    0x0C: "\u000C",  # FORM FEED
    0x0D: "\u000D",  # CARRIAGE RETURN
    0x0E: "\u000E",  # SHIFT OUT
    0x0F: "\u000F",  # SHIFT IN
    0x10: "\u0010",  # DATA LINK ESCAPE
    0x11: "\u0011",  # DEVICE CONTROL 1
    0x12: "\u0012",  # DEVICE CONTROL 2
    0x13: "\u0013",  # DEVICE CONTROL 3
    0x14: "\u0014",  # DEVICE CONTROL 4
    0x15: "\u0015",  # NEGATIVE-ACKNOWLEDGE CHARACTER
    0x16: "\u0016",  # SYNCHRONOUS IDLE
    0x17: "\u0017",  # END OF TRANSMISSION BLOCK
    0x18: "\u0018",  # CANCEL CHARACTER
    0x19: "\u0019",  # END OF MEDIUM
    0x1A: "\u001A",  # SUBSTITUTE CHARACTER
    0x1B: "\u001B",  # ESCAPE CHARACTER
    0x1C: "\u001C",  # FILE SEPARATOR
    0x1D: "\u001D",  # GROUP SEPARATOR
    0x1E: "\u001E",  # RECORD SEPARATOR
    0x1F: "\u001F",  # UNIT SEPARATOR
}

ANSEL_TO_UNICODE = {
    0x20: "\u0020",  # SPACE
    0x21: "\u0021",  # EXCLAMATION MARK
    0x22: "\u0022",  # QUOTATION MARK
    0x23: "\u0023",  # NUMBER SIGN
    0x24: "\u0024",  # DOLLAR SIGN
    0x25: "\u0025",  # PERCENT SIGN
    0x26: "\u0026",  # AMPERSAND
    0x27: "\u0027",  # APOSTROPHE
    0x28: "\u0028",  # LEFT PARENTHESIS
    0x29: "\u0029",  # RIGHT PARENTHESIS
    0x2A: "\u002A",  # ASTERISK
    0x2B: "\u002B",  # PLUS SIGN
    0x2C: "\u002C",  # COMMA
    0x2D: "\u002D",  # HYPHEN-MINUS
    0x2E: "\u002E",  # FULL STOP
    0x2F: "\u002F",  # SOLIDUS
    0x30: "\u0030",  # DIGIT ZERO
    0x31: "\u0031",  # DIGIT ONE
    0x32: "\u0032",  # DIGIT TWO
    0x33: "\u0033",  # DIGIT THREE
    0x34: "\u0034",  # DIGIT FOUR
    0x35: "\u0035",  # DIGIT FIVE
    0x36: "\u0036",  # DIGIT SIX
    0x37: "\u0037",  # DIGIT SEVEN
    0x38: "\u0038",  # DIGIT EIGHT
    0x39: "\u0039",  # DIGIT NINE
    0x3A: "\u003A",  # COLON
    0x3B: "\u003B",  # SEMICOLON
    0x3C: "\u003C",  # LESS-THAN SIGN
    0x3D: "\u003D",  # EQUALS SIGN
    0x3E: "\u003E",  # GREATER-THAN SIGN
    0x3F: "\u003F",  # QUESTION MARK
    0x40: "\u0040",  # COMMERCIAL AT
    0x41: "\u0041",  # LATIN CAPITAL LETTER A
    0x42: "\u0042",  # LATIN CAPITAL LETTER B
    0x43: "\u0043",  # LATIN CAPITAL LETTER C
    0x44: "\u0044",  # LATIN CAPITAL LETTER D
    0x45: "\u0045",  # LATIN CAPITAL LETTER E
    0x46: "\u0046",  # LATIN CAPITAL LETTER F
    0x47: "\u0047",  # LATIN CAPITAL LETTER G
    0x48: "\u0048",  # LATIN CAPITAL LETTER H
    0x49: "\u0049",  # LATIN CAPITAL LETTER I
    0x4A: "\u004A",  # LATIN CAPITAL LETTER J
    0x4B: "\u004B",  # LATIN CAPITAL LETTER K
    0x4C: "\u004C",  # LATIN CAPITAL LETTER L
    0x4D: "\u004D",  # LATIN CAPITAL LETTER M
    0x4E: "\u004E",  # LATIN CAPITAL LETTER N
    0x4F: "\u004F",  # LATIN CAPITAL LETTER O
    0x50: "\u0050",  # LATIN CAPITAL LETTER P
    0x51: "\u0051",  # LATIN CAPITAL LETTER Q
    0x52: "\u0052",  # LATIN CAPITAL LETTER R
    0x53: "\u0053",  # LATIN CAPITAL LETTER S
    0x54: "\u0054",  # LATIN CAPITAL LETTER T
    0x55: "\u0055",  # LATIN CAPITAL LETTER U
    0x56: "\u0056",  # LATIN CAPITAL LETTER V
    0x57: "\u0057",  # LATIN CAPITAL LETTER W
    0x58: "\u0058",  # LATIN CAPITAL LETTER X
    0x59: "\u0059",  # LATIN CAPITAL LETTER Y
    0x5A: "\u005A",  # LATIN CAPITAL LETTER Z
    0x5B: "\u005B",  # LEFT SQUARE BRACKET
    0x5C: "\u005C",  # REVERSE SOLIDUS
    0x5D: "\u005D",  # RIGHT SQUARE BRACKET
    0x5E: "\u005E",  # CIRCUMFLEX ACCENT
    0x5F: "\u005F",  # LOW LINE
    0x60: "\u0060",  # GRAVE ACCENT
    0x61: "\u0061",  # LATIN SMALL LETTER A
    0x62: "\u0062",  # LATIN SMALL LETTER B
    0x63: "\u0063",  # LATIN SMALL LETTER C
    0x64: "\u0064",  # LATIN SMALL LETTER D
    0x65: "\u0065",  # LATIN SMALL LETTER E
    0x66: "\u0066",  # LATIN SMALL LETTER F
    0x67: "\u0067",  # LATIN SMALL LETTER G
    0x68: "\u0068",  # LATIN SMALL LETTER H
    0x69: "\u0069",  # LATIN SMALL LETTER I
    0x6A: "\u006A",  # LATIN SMALL LETTER J
    0x6B: "\u006B",  # LATIN SMALL LETTER K
    0x6C: "\u006C",  # LATIN SMALL LETTER L
    0x6D: "\u006D",  # LATIN SMALL LETTER M
    0x6E: "\u006E",  # LATIN SMALL LETTER N
    0x6F: "\u006F",  # LATIN SMALL LETTER O
    0x70: "\u0070",  # LATIN SMALL LETTER P
    0x71: "\u0071",  # LATIN SMALL LETTER Q
    0x72: "\u0072",  # LATIN SMALL LETTER R
    0x73: "\u0073",  # LATIN SMALL LETTER S
    0x74: "\u0074",  # LATIN SMALL LETTER T
    0x75: "\u0075",  # LATIN SMALL LETTER U
    0x76: "\u0076",  # LATIN SMALL LETTER V
    0x77: "\u0077",  # LATIN SMALL LETTER W
    0x78: "\u0078",  # LATIN SMALL LETTER X
    0x79: "\u0079",  # LATIN SMALL LETTER Y
    0x7A: "\u007A",  # LATIN SMALL LETTER Z
    0x7B: "\u007B",  # LEFT CURLY BRACKET
    0x7C: "\u007C",  # VERTICAL LINE
    0x7D: "\u007D",  # RIGHT CURLY BRACKET
    0x7E: "\u007E",  # TILDE
    0x7F: "\u007F",  # DELETE
    0xA1: "\u0141",  # LATIN CAPITAL LETTER L WITH STROKE
    0xA2: "\u00D8",  # LATIN CAPITAL LETTER O WITH STROKE
    0xA3: "\u0110",  # LATIN CAPITAL LETTER D WITH STROKE
    0xA4: "\u00DE",  # LATIN CAPITAL LETTER THORN
    0xA5: "\u00C6",  # LATIN CAPITAL LETTER AE
    0xA6: "\u0152",  # LATIN CAPITAL LIGATURE OE
    0xA7: "\u02B9",  # MODIFIER LETTER PRIME
    0xA8: "\u00B7",  # MIDDLE DOT
    0xA9: "\u266D",  # MUSIC FLAT SIGN
    0xAA: "\u00AE",  # REGISTERED SIGN
    0xAB: "\u00B1",  # PLUS-MINUS SIGN
    0xAC: "\u01A0",  # LATIN CAPITAL LETTER O WITH HORN
    0xAD: "\u01AF",  # LATIN CAPITAL LETTER U WITH HORN
    0xAE: "\u02BC",  # MODIFIER LETTER APOSTROPHE
    0xB0: "\u02BB",  # MODIFIER LETTER TURNED COMMA
    0xB1: "\u0142",  # LATIN SMALL LETTER L WITH STROKE
    0xB2: "\u00F8",  # LATIN SMALL LETTER O WITH STROKE
    0xB3: "\u0111",  # LATIN SMALL LETTER D WITH STROKE
    0xB4: "\u00FE",  # LATIN SMALL LETTER THORN
    0xB5: "\u00E6",  # LATIN SMALL LETTER AE
    0xB6: "\u0153",  # LATIN SMALL LIGATURE OE
    0xB7: "\u02BA",  # MODIFIER LETTER DOUBLE PRIME
    0xB8: "\u0131",  # LATIN SMALL LETTER DOTLESS I
    0xB9: "\u00A3",  # POUND SIGN
    0xBA: "\u00F0",  # LATIN SMALL LETTER ETH
    0xBC: "\u01A1",  # LATIN SMALL LETTER O WITH HORN
    0xBD: "\u01B0",  # LATIN SMALL LETTER U WITH HORN
    0xC0: "\u00B0",  # DEGREE SIGN
    0xC1: "\u2113",  # SCRIPT SMALL L
    0xC2: "\u2117",  # SOUND RECORDING COPYRIGHT
    0xC3: "\u00A9",  # COPYRIGHT SIGN
    0xC4: "\u266F",  # MUSIC SHARP SIGN
    0xC5: "\u00BF",  # INVERTED QUESTION MARK
    0xC6: "\u00A1",  # INVERTED EXCLAMATION MARK
}

ANSEL_TO_UNICODE_MODIFIERS = {
    0xE0: "\u0309",  # COMBINING HOOK ABOVE
    0xE1: "\u0300",  # COMBINING GRAVE ACCENT
    0xE2: "\u0301",  # COMBINING ACUTE ACCENT
    0xE3: "\u0302",  # COMBINING CIRCUMFLEX ACCENT
    0xE4: "\u0303",  # COMBINING TILDE
    0xE5: "\u0304",  # COMBINING MACRON
    0xE6: "\u0306",  # COMBINING BREVE
    0xE7: "\u0307",  # COMBINING DOT ABOVE
    0xE8: "\u0308",  # COMBINING DIAERESIS
    0xE9: "\u030C",  # COMBINING CARON
    0xEA: "\u030A",  # COMBINING RING ABOVE
    0xEB: "\uFE20",  # COMBINING LIGATURE LEFT HALF
    0xEC: "\uFE21",  # COMBINING LIGATURE RIGHT HALF
    0xED: "\u0315",  # COMBINING COMMA ABOVE RIGHT
    0xEE: "\u030B",  # COMBINING DOUBLE ACUTE ACCENT
    0xEF: "\u0310",  # COMBINING CANDRABINDU
    0xF0: "\u0327",  # COMBINING CEDILLA
    0xF1: "\u0328",  # COMBINING OGONEK
    0xF2: "\u0323",  # COMBINING DOT BELOW
    0xF3: "\u0324",  # COMBINING DIAERESIS BELOW
    0xF4: "\u0325",  # COMBINING RING BELOW
    0xF5: "\u0333",  # COMBINING DOUBLE LOW LINE
    0xF6: "\u0332",  # COMBINING LOW LINE
    0xF7: "\u0326",  # COMBINING COMMA BELOW
    0xF8: "\u031C",  # COMBINING LEFT HALF RING BELOW
    0xF9: "\u032E",  # COMBINING BREVE BELOW
    0xFA: "\uFE22",  # COMBINING DOUBLE TILDE LEFT HALF
    0xFB: "\uFE23",  # COMBINING DOUBLE TILDE RIGHT HALF
    0xFE: "\u0313",  # COMBINING COMMA ABOVE
}

UNICODE_TO_ANSEL = {
    "\u0000": b"\x00",  # NULL CHARACTER
    "\u0001": b"\x01",  # START OF HEADING
    "\u0002": b"\x02",  # START OF TEXT
    "\u0003": b"\x03",  # END-OF-TEXT CHARACTER
    "\u0004": b"\x04",  # END-OF-TRANSMISSION CHARACTER
    "\u0005": b"\x05",  # ENQUIRY CHARACTER
    "\u0006": b"\x06",  # ACKNOWLEDGE CHARACTER
    "\u0007": b"\x07",  # BELL CHARACTER
    "\u0008": b"\x08",  # BACKSPACE
    "\u0009": b"\x09",  # HORIZONTAL TAB
    "\u000A": b"\x0A",  # LINE FEED
    "\u000B": b"\x0B",  # VERTICAL TAB
    "\u000C": b"\x0C",  # FORM FEED
    "\u000D": b"\x0D",  # CARRIAGE RETURN
    "\u000E": b"\x0E",  # SHIFT OUT
    "\u000F": b"\x0F",  # SHIFT IN
    "\u0010": b"\x10",  # DATA LINK ESCAPE
    "\u0011": b"\x11",  # DEVICE CONTROL 1
    "\u0012": b"\x12",  # DEVICE CONTROL 2
    "\u0013": b"\x13",  # DEVICE CONTROL 3
    "\u0014": b"\x14",  # DEVICE CONTROL 4
    "\u0015": b"\x15",  # NEGATIVE-ACKNOWLEDGE CHARACTER
    "\u0016": b"\x16",  # SYNCHRONOUS IDLE
    "\u0017": b"\x17",  # END OF TRANSMISSION BLOCK
    "\u0018": b"\x18",  # CANCEL CHARACTER
    "\u0019": b"\x19",  # END OF MEDIUM
    "\u001A": b"\x1A",  # SUBSTITUTE CHARACTER
    "\u001B": b"\x1B",  # ESCAPE CHARACTER
    "\u001C": b"\x1C",  # FILE SEPARATOR
    "\u001D": b"\x1D",  # GROUP SEPARATOR
    "\u001E": b"\x1E",  # RECORD SEPARATOR
    "\u001F": b"\x1F",  # UNIT SEPARATOR
    "\u0020": b"\x20",  # SPACE
    "\u0021": b"\x21",  # EXCLAMATION MARK
    "\u0022": b"\x22",  # QUOTATION MARK
    "\u0023": b"\x23",  # NUMBER SIGN
    "\u0024": b"\x24",  # DOLLAR SIGN
    "\u0025": b"\x25",  # PERCENT SIGN
    "\u0026": b"\x26",  # AMPERSAND
    "\u0027": b"\x27",  # APOSTROPHE
    "\u0028": b"\x28",  # LEFT PARENTHESIS
    "\u0029": b"\x29",  # RIGHT PARENTHESIS
    "\u002A": b"\x2A",  # ASTERISK
    "\u002B": b"\x2B",  # PLUS SIGN
    "\u002C": b"\x2C",  # COMMA
    "\u002D": b"\x2D",  # HYPHEN-MINUS
    "\u002E": b"\x2E",  # FULL STOP
    "\u002F": b"\x2F",  # SOLIDUS
    "\u0030": b"\x30",  # DIGIT ZERO
    "\u0031": b"\x31",  # DIGIT ONE
    "\u0032": b"\x32",  # DIGIT TWO
    "\u0033": b"\x33",  # DIGIT THREE
    "\u0034": b"\x34",  # DIGIT FOUR
    "\u0035": b"\x35",  # DIGIT FIVE
    "\u0036": b"\x36",  # DIGIT SIX
    "\u0037": b"\x37",  # DIGIT SEVEN
    "\u0038": b"\x38",  # DIGIT EIGHT
    "\u0039": b"\x39",  # DIGIT NINE
    "\u003A": b"\x3A",  # COLON
    "\u003B": b"\x3B",  # SEMICOLON
    "\u003C": b"\x3C",  # LESS-THAN SIGN
    "\u003D": b"\x3D",  # EQUALS SIGN
    "\u003E": b"\x3E",  # GREATER-THAN SIGN
    "\u003F": b"\x3F",  # QUESTION MARK
    "\u0040": b"\x40",  # COMMERCIAL AT
    "\u0041": b"\x41",  # LATIN CAPITAL LETTER A
    "\u0042": b"\x42",  # LATIN CAPITAL LETTER B
    "\u0043": b"\x43",  # LATIN CAPITAL LETTER C
    "\u0044": b"\x44",  # LATIN CAPITAL LETTER D
    "\u0045": b"\x45",  # LATIN CAPITAL LETTER E
    "\u0046": b"\x46",  # LATIN CAPITAL LETTER F
    "\u0047": b"\x47",  # LATIN CAPITAL LETTER G
    "\u0048": b"\x48",  # LATIN CAPITAL LETTER H
    "\u0049": b"\x49",  # LATIN CAPITAL LETTER I
    "\u004A": b"\x4A",  # LATIN CAPITAL LETTER J
    "\u004B": b"\x4B",  # LATIN CAPITAL LETTER K
    "\u004C": b"\x4C",  # LATIN CAPITAL LETTER L
    "\u004D": b"\x4D",  # LATIN CAPITAL LETTER M
    "\u004E": b"\x4E",  # LATIN CAPITAL LETTER N
    "\u004F": b"\x4F",  # LATIN CAPITAL LETTER O
    "\u0050": b"\x50",  # LATIN CAPITAL LETTER P
    "\u0051": b"\x51",  # LATIN CAPITAL LETTER Q
    "\u0052": b"\x52",  # LATIN CAPITAL LETTER R
    "\u0053": b"\x53",  # LATIN CAPITAL LETTER S
    "\u0054": b"\x54",  # LATIN CAPITAL LETTER T
    "\u0055": b"\x55",  # LATIN CAPITAL LETTER U
    "\u0056": b"\x56",  # LATIN CAPITAL LETTER V
    "\u0057": b"\x57",  # LATIN CAPITAL LETTER W
    "\u0058": b"\x58",  # LATIN CAPITAL LETTER X
    "\u0059": b"\x59",  # LATIN CAPITAL LETTER Y
    "\u005A": b"\x5A",  # LATIN CAPITAL LETTER Z
    "\u005B": b"\x5B",  # LEFT SQUARE BRACKET
    "\u005C": b"\x5C",  # REVERSE SOLIDUS
    "\u005D": b"\x5D",  # RIGHT SQUARE BRACKET
    "\u005E": b"\x5E",  # CIRCUMFLEX ACCENT
    "\u005F": b"\x5F",  # LOW LINE
    "\u0060": b"\x60",  # GRAVE ACCENT
    "\u0061": b"\x61",  # LATIN SMALL LETTER A
    "\u0062": b"\x62",  # LATIN SMALL LETTER B
    "\u0063": b"\x63",  # LATIN SMALL LETTER C
    "\u0064": b"\x64",  # LATIN SMALL LETTER D
    "\u0065": b"\x65",  # LATIN SMALL LETTER E
    "\u0066": b"\x66",  # LATIN SMALL LETTER F
    "\u0067": b"\x67",  # LATIN SMALL LETTER G
    "\u0068": b"\x68",  # LATIN SMALL LETTER H
    "\u0069": b"\x69",  # LATIN SMALL LETTER I
    "\u006A": b"\x6A",  # LATIN SMALL LETTER J
    "\u006B": b"\x6B",  # LATIN SMALL LETTER K
    "\u006C": b"\x6C",  # LATIN SMALL LETTER L
    "\u006D": b"\x6D",  # LATIN SMALL LETTER M
    "\u006E": b"\x6E",  # LATIN SMALL LETTER N
    "\u006F": b"\x6F",  # LATIN SMALL LETTER O
    "\u0070": b"\x70",  # LATIN SMALL LETTER P
    "\u0071": b"\x71",  # LATIN SMALL LETTER Q
    "\u0072": b"\x72",  # LATIN SMALL LETTER R
    "\u0073": b"\x73",  # LATIN SMALL LETTER S
    "\u0074": b"\x74",  # LATIN SMALL LETTER T
    "\u0075": b"\x75",  # LATIN SMALL LETTER U
    "\u0076": b"\x76",  # LATIN SMALL LETTER V
    "\u0077": b"\x77",  # LATIN SMALL LETTER W
    "\u0078": b"\x78",  # LATIN SMALL LETTER X
    "\u0079": b"\x79",  # LATIN SMALL LETTER Y
    "\u007A": b"\x7A",  # LATIN SMALL LETTER Z
    "\u007B": b"\x7B",  # LEFT CURLY BRACKET
    "\u007C": b"\x7C",  # VERTICAL LINE
    "\u007D": b"\x7D",  # RIGHT CURLY BRACKET
    "\u007E": b"\x7E",  # TILDE
    "\u007F": b"\x7F",  # DELETE
    "\u00A1": b"\xC6",  # INVERTED EXCLAMATION MARK
    "\u00A3": b"\xB9",  # POUND SIGN
    "\u00A9": b"\xC3",  # COPYRIGHT SIGN
    "\u00AE": b"\xAA",  # REGISTERED SIGN
    "\u00B0": b"\xC0",  # DEGREE SIGN
    "\u00B1": b"\xAB",  # PLUS-MINUS SIGN
    "\u00B7": b"\xA8",  # MIDDLE DOT
    "\u00BF": b"\xC5",  # INVERTED QUESTION MARK
    "\u00C0": b"\xE1\x41",  # LATIN CAPITAL LETTER A WITH GRAVE
    "\u00C1": b"\xE2\x41",  # LATIN CAPITAL LETTER A WITH ACUTE
    "\u00C2": b"\xE3\x41",  # LATIN CAPITAL LETTER A WITH CIRCUMFLEX
    "\u00C3": b"\xE4\x41",  # LATIN CAPITAL LETTER A WITH TILDE
    "\u00C4": b"\xE8\x41",  # LATIN CAPITAL LETTER A WITH DIAERESIS
    "\u00C5": b"\xEA\x41",  # LATIN CAPITAL LETTER A WITH RING ABOVE
    "\u00C6": b"\xA5",  # LATIN CAPITAL LETTER AE
    "\u00C7": b"\xF0\x43",  # LATIN CAPITAL LETTER C WITH CEDILLA
    "\u00C8": b"\xE1\x45",  # LATIN CAPITAL LETTER E WITH GRAVE
    "\u00C9": b"\xE2\x45",  # LATIN CAPITAL LETTER E WITH ACUTE
    "\u00CA": b"\xE3\x45",  # LATIN CAPITAL LETTER E WITH CIRCUMFLEX
    "\u00CB": b"\xE8\x45",  # LATIN CAPITAL LETTER E WITH DIAERESIS
    "\u00CC": b"\xE1\x49",  # LATIN CAPITAL LETTER I WITH GRAVE
    "\u00CD": b"\xE2\x49",  # LATIN CAPITAL LETTER I WITH ACUTE
    "\u00CE": b"\xE3\x49",  # LATIN CAPITAL LETTER I WITH CIRCUMFLEX
    "\u00CF": b"\xE8\x49",  # LATIN CAPITAL LETTER I WITH DIAERESIS
    "\u00D1": b"\xE4\x4E",  # LATIN CAPITAL LETTER N WITH TILDE
    "\u00D2": b"\xE1\x4F",  # LATIN CAPITAL LETTER O WITH GRAVE
    "\u00D3": b"\xE2\x4F",  # LATIN CAPITAL LETTER O WITH ACUTE
    "\u00D4": b"\xE3\x4F",  # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
    "\u00D5": b"\xE4\x4F",  # LATIN CAPITAL LETTER O WITH TILDE
    "\u00D6": b"\xE8\x4F",  # LATIN CAPITAL LETTER O WITH DIAERESIS
    "\u00D8": b"\xA2",  # LATIN CAPITAL LETTER O WITH STROKE
    "\u00D9": b"\xE1\x55",  # LATIN CAPITAL LETTER U WITH GRAVE
    "\u00DA": b"\xE2\x55",  # LATIN CAPITAL LETTER U WITH ACUTE
    "\u00DB": b"\xE3\x55",  # LATIN CAPITAL LETTER U WITH CIRCUMFLEX
    "\u00DC": b"\xE8\x55",  # LATIN CAPITAL LETTER U WITH DIAERESIS
    "\u00DD": b"\xE2\x59",  # LATIN CAPITAL LETTER Y WITH ACUTE
    "\u00DE": b"\xA4",  # LATIN CAPITAL LETTER THORN
    "\u00E0": b"\xE1\x61",  # LATIN SMALL LETTER A WITH GRAVE
    "\u00E1": b"\xE2\x61",  # LATIN SMALL LETTER A WITH ACUTE
    "\u00E2": b"\xE3\x61",  # LATIN SMALL LETTER A WITH CIRCUMFLEX
    "\u00E3": b"\xE4\x61",  # LATIN SMALL LETTER A WITH TILDE
    "\u00E4": b"\xE8\x61",  # LATIN SMALL LETTER A WITH DIAERESIS
    "\u00E5": b"\xEA\x61",  # LATIN SMALL LETTER A WITH RING ABOVE
    "\u00E6": b"\xB5",  # LATIN SMALL LETTER AE
    "\u00E7": b"\xF0\x63",  # LATIN SMALL LETTER C WITH CEDILLA
    "\u00E8": b"\xE1\x65",  # LATIN SMALL LETTER E WITH GRAVE
    "\u00E9": b"\xE2\x65",  # LATIN SMALL LETTER E WITH ACUTE
    "\u00EA": b"\xE3\x65",  # LATIN SMALL LETTER E WITH CIRCUMFLEX
    "\u00EB": b"\xE8\x65",  # LATIN SMALL LETTER E WITH DIAERESIS
    "\u00EC": b"\xE1\x69",  # LATIN SMALL LETTER I WITH GRAVE
    "\u00ED": b"\xE2\x69",  # LATIN SMALL LETTER I WITH ACUTE
    "\u00EE": b"\xE3\x69",  # LATIN SMALL LETTER I WITH CIRCUMFLEX
    "\u00EF": b"\xE8\x69",  # LATIN SMALL LETTER I WITH DIAERESIS
    "\u00F0": b"\xBA",  # LATIN SMALL LETTER ETH
    "\u00F1": b"\xE4\x6E",  # LATIN SMALL LETTER N WITH TILDE
    "\u00F2": b"\xE1\x6F",  # LATIN SMALL LETTER O WITH GRAVE
    "\u00F3": b"\xE2\x6F",  # LATIN SMALL LETTER O WITH ACUTE
    "\u00F4": b"\xE3\x6F",  # LATIN SMALL LETTER O WITH CIRCUMFLEX
    "\u00F5": b"\xE4\x6F",  # LATIN SMALL LETTER O WITH TILDE
    "\u00F6": b"\xE8\x6F",  # LATIN SMALL LETTER O WITH DIAERESIS
    "\u00F8": b"\xB2",  # LATIN SMALL LETTER O WITH STROKE
    "\u00F9": b"\xE1\x75",  # LATIN SMALL LETTER U WITH GRAVE
    "\u00FA": b"\xE2\x75",  # LATIN SMALL LETTER U WITH ACUTE
    "\u00FB": b"\xE3\x75",  # LATIN SMALL LETTER U WITH CIRCUMFLEX
    "\u00FC": b"\xE8\x75",  # LATIN SMALL LETTER U WITH DIAERESIS
    "\u00FD": b"\xE2\x79",  # LATIN SMALL LETTER Y WITH ACUTE
    "\u00FE": b"\xB4",  # LATIN SMALL LETTER THORN
    "\u00FF": b"\xE8\x79",  # LATIN SMALL LETTER Y WITH DIAERESIS
    "\u0100": b"\xE5\x41",  # LATIN CAPITAL LETTER A WITH MACRON
    "\u0101": b"\xE5\x61",  # LATIN SMALL LETTER A WITH MACRON
    "\u0102": b"\xE6\x41",  # LATIN CAPITAL LETTER A WITH BREVE
    "\u0103": b"\xE6\x61",  # LATIN SMALL LETTER A WITH BREVE
    "\u0104": b"\xF1\x41",  # LATIN CAPITAL LETTER A WITH OGONEK
    "\u0105": b"\xF1\x61",  # LATIN SMALL LETTER A WITH OGONEK
    "\u0106": b"\xE2\x43",  # LATIN CAPITAL LETTER C WITH ACUTE
    "\u0107": b"\xE2\x63",  # LATIN SMALL LETTER C WITH ACUTE
    "\u0108": b"\xE3\x43",  # LATIN CAPITAL LETTER C WITH CIRCUMFLEX
    "\u0109": b"\xE3\x63",  # LATIN SMALL LETTER C WITH CIRCUMFLEX
    "\u010A": b"\xE7\x43",  # LATIN CAPITAL LETTER C WITH DOT ABOVE
    "\u010B": b"\xE7\x63",  # LATIN SMALL LETTER C WITH DOT ABOVE
    "\u010C": b"\xE9\x43",  # LATIN CAPITAL LETTER C WITH CARON
    "\u010D": b"\xE9\x63",  # LATIN SMALL LETTER C WITH CARON
    "\u010E": b"\xE9\x44",  # LATIN CAPITAL LETTER D WITH CARON
    "\u010F": b"\xE9\x64",  # LATIN SMALL LETTER D WITH CARON
    "\u0110": b"\xA3",  # LATIN CAPITAL LETTER D WITH STROKE
    "\u0111": b"\xB3",  # LATIN SMALL LETTER D WITH STROKE
    "\u0112": b"\xE5\x45",  # LATIN CAPITAL LETTER E WITH MACRON
    "\u0113": b"\xE5\x65",  # LATIN SMALL LETTER E WITH MACRON
    "\u0114": b"\xE6\x45",  # LATIN CAPITAL LETTER E WITH BREVE
    "\u0115": b"\xE6\x65",  # LATIN SMALL LETTER E WITH BREVE
    "\u0116": b"\xE7\x45",  # LATIN CAPITAL LETTER E WITH DOT ABOVE
    "\u0117": b"\xE7\x65",  # LATIN SMALL LETTER E WITH DOT ABOVE
    "\u0118": b"\xF1\x45",  # LATIN CAPITAL LETTER E WITH OGONEK
    "\u0119": b"\xF1\x65",  # LATIN SMALL LETTER E WITH OGONEK
    "\u011A": b"\xE9\x45",  # LATIN CAPITAL LETTER E WITH CARON
    "\u011B": b"\xE9\x65",  # LATIN SMALL LETTER E WITH CARON
    "\u011C": b"\xE3\x47",  # LATIN CAPITAL LETTER G WITH CIRCUMFLEX
    "\u011D": b"\xE3\x67",  # LATIN SMALL LETTER G WITH CIRCUMFLEX
    "\u011E": b"\xE6\x47",  # LATIN CAPITAL LETTER G WITH BREVE
    "\u011F": b"\xE6\x67",  # LATIN SMALL LETTER G WITH BREVE
    "\u0120": b"\xE7\x47",  # LATIN CAPITAL LETTER G WITH DOT ABOVE
    "\u0121": b"\xE7\x67",  # LATIN SMALL LETTER G WITH DOT ABOVE
    "\u0122": b"\xF0\x47",  # LATIN CAPITAL LETTER G WITH CEDILLA
    "\u0123": b"\xF0\x67",  # LATIN SMALL LETTER G WITH CEDILLA
    "\u0124": b"\xE3\x48",  # LATIN CAPITAL LETTER H WITH CIRCUMFLEX
    "\u0125": b"\xE3\x68",  # LATIN SMALL LETTER H WITH CIRCUMFLEX
    "\u0128": b"\xE4\x49",  # LATIN CAPITAL LETTER I WITH TILDE
    "\u0129": b"\xE4\x69",  # LATIN SMALL LETTER I WITH TILDE
    "\u012A": b"\xE5\x49",  # LATIN CAPITAL LETTER I WITH MACRON
    "\u012B": b"\xE5\x69",  # LATIN SMALL LETTER I WITH MACRON
    "\u012C": b"\xE6\x49",  # LATIN CAPITAL LETTER I WITH BREVE
    "\u012D": b"\xE6\x69",  # LATIN SMALL LETTER I WITH BREVE
    "\u012E": b"\xF1\x49",  # LATIN CAPITAL LETTER I WITH OGONEK
    "\u012F": b"\xF1\x69",  # LATIN SMALL LETTER I WITH OGONEK
    "\u0130": b"\xE7\x49",  # LATIN CAPITAL LETTER I WITH DOT ABOVE
    "\u0131": b"\xB8",  # LATIN SMALL LETTER DOTLESS I
    "\u0134": b"\xE3\x4A",  # LATIN CAPITAL LETTER J WITH CIRCUMFLEX
    "\u0135": b"\xE3\x6A",  # LATIN SMALL LETTER J WITH CIRCUMFLEX
    "\u0136": b"\xF0\x4B",  # LATIN CAPITAL LETTER K WITH CEDILLA
    "\u0137": b"\xF0\x6B",  # LATIN SMALL LETTER K WITH CEDILLA
    "\u0139": b"\xE2\x4C",  # LATIN CAPITAL LETTER L WITH ACUTE
    "\u013A": b"\xE2\x6C",  # LATIN SMALL LETTER L WITH ACUTE
    "\u013B": b"\xF0\x4C",  # LATIN CAPITAL LETTER L WITH CEDILLA
    "\u013C": b"\xF0\x6C",  # LATIN SMALL LETTER L WITH CEDILLA
    "\u013D": b"\xE9\x4C",  # LATIN CAPITAL LETTER L WITH CARON
    "\u013E": b"\xE9\x6C",  # LATIN SMALL LETTER L WITH CARON
    "\u0141": b"\xA1",  # LATIN CAPITAL LETTER L WITH STROKE
    "\u0142": b"\xB1",  # LATIN SMALL LETTER L WITH STROKE
    "\u0143": b"\xE2\x4E",  # LATIN CAPITAL LETTER N WITH ACUTE
    "\u0144": b"\xE2\x6E",  # LATIN SMALL LETTER N WITH ACUTE
    "\u0145": b"\xF0\x4E",  # LATIN CAPITAL LETTER N WITH CEDILLA
    "\u0146": b"\xF0\x6E",  # LATIN SMALL LETTER N WITH CEDILLA
    "\u0147": b"\xE9\x4E",  # LATIN CAPITAL LETTER N WITH CARON
    "\u0148": b"\xE9\x6E",  # LATIN SMALL LETTER N WITH CARON
    "\u014C": b"\xE5\x4F",  # LATIN CAPITAL LETTER O WITH MACRON
    "\u014D": b"\xE5\x6F",  # LATIN SMALL LETTER O WITH MACRON
    "\u014E": b"\xE6\x4F",  # LATIN CAPITAL LETTER O WITH BREVE
    "\u014F": b"\xE6\x6F",  # LATIN SMALL LETTER O WITH BREVE
    "\u0150": b"\xEE\x4F",  # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
    "\u0151": b"\xEE\x6F",  # LATIN SMALL LETTER O WITH DOUBLE ACUTE
    "\u0152": b"\xA6",  # LATIN CAPITAL LIGATURE OE
    "\u0153": b"\xB6",  # LATIN SMALL LIGATURE OE
    "\u0154": b"\xE2\x52",  # LATIN CAPITAL LETTER R WITH ACUTE
    "\u0155": b"\xE2\x72",  # LATIN SMALL LETTER R WITH ACUTE
    "\u0156": b"\xF0\x52",  # LATIN CAPITAL LETTER R WITH CEDILLA
    "\u0157": b"\xF0\x72",  # LATIN SMALL LETTER R WITH CEDILLA
    "\u0158": b"\xE9\x52",  # LATIN CAPITAL LETTER R WITH CARON
    "\u0159": b"\xE9\x72",  # LATIN SMALL LETTER R WITH CARON
    "\u015A": b"\xE2\x53",  # LATIN CAPITAL LETTER S WITH ACUTE
    "\u015B": b"\xE2\x73",  # LATIN SMALL LETTER S WITH ACUTE
    "\u015C": b"\xE3\x53",  # LATIN CAPITAL LETTER S WITH CIRCUMFLEX
    "\u015D": b"\xE3\x73",  # LATIN SMALL LETTER S WITH CIRCUMFLEX
    "\u015E": b"\xF0\x53",  # LATIN CAPITAL LETTER S WITH CEDILLA
    "\u015F": b"\xF0\x73",  # LATIN SMALL LETTER S WITH CEDILLA
    "\u0160": b"\xE9\x53",  # LATIN CAPITAL LETTER S WITH CARON
    "\u0161": b"\xE9\x73",  # LATIN SMALL LETTER S WITH CARON
    "\u0162": b"\xF0\x54",  # LATIN CAPITAL LETTER T WITH CEDILLA
    "\u0163": b"\xF0\x74",  # LATIN SMALL LETTER T WITH CEDILLA
    "\u0164": b"\xE9\x54",  # LATIN CAPITAL LETTER T WITH CARON
    "\u0165": b"\xE9\x74",  # LATIN SMALL LETTER T WITH CARON
    "\u0168": b"\xE4\x55",  # LATIN CAPITAL LETTER U WITH TILDE
    "\u0169": b"\xE4\x75",  # LATIN SMALL LETTER U WITH TILDE
    "\u016A": b"\xE5\x55",  # LATIN CAPITAL LETTER U WITH MACRON
    "\u016B": b"\xE5\x75",  # LATIN SMALL LETTER U WITH MACRON
    "\u016C": b"\xE6\x55",  # LATIN CAPITAL LETTER U WITH BREVE
    "\u016D": b"\xE6\x75",  # LATIN SMALL LETTER U WITH BREVE
    "\u016E": b"\xEA\x55",  # LATIN CAPITAL LETTER U WITH RING ABOVE
    "\u016F": b"\xEA\x75",  # LATIN SMALL LETTER U WITH RING ABOVE
    "\u0170": b"\xEE\x55",  # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
    "\u0171": b"\xEE\x75",  # LATIN SMALL LETTER U WITH DOUBLE ACUTE
    "\u0172": b"\xF1\x55",  # LATIN CAPITAL LETTER U WITH OGONEK
    "\u0173": b"\xF1\x75",  # LATIN SMALL LETTER U WITH OGONEK
    "\u0174": b"\xE3\x57",  # LATIN CAPITAL LETTER W WITH CIRCUMFLEX
    "\u0175": b"\xE3\x77",  # LATIN SMALL LETTER W WITH CIRCUMFLEX
    "\u0176": b"\xE3\x59",  # LATIN CAPITAL LETTER Y WITH CIRCUMFLEX
    "\u0177": b"\xE3\x79",  # LATIN SMALL LETTER Y WITH CIRCUMFLEX
    "\u0178": b"\xE8\x59",  # LATIN CAPITAL LETTER Y WITH DIAERESIS
    "\u0179": b"\xE2\x5A",  # LATIN CAPITAL LETTER Z WITH ACUTE
    "\u017A": b"\xE2\x7A",  # LATIN SMALL LETTER Z WITH ACUTE
    "\u017B": b"\xE7\x5A",  # LATIN CAPITAL LETTER Z WITH DOT ABOVE
    "\u017C": b"\xE7\x7A",  # LATIN SMALL LETTER Z WITH DOT ABOVE
    "\u017D": b"\xE9\x5A",  # LATIN CAPITAL LETTER Z WITH CARON
    "\u017E": b"\xE9\x7A",  # LATIN SMALL LETTER Z WITH CARON
    "\u01A0": b"\xAC",  # LATIN CAPITAL LETTER O WITH HORN
    "\u01A1": b"\xBC",  # LATIN SMALL LETTER O WITH HORN
    "\u01AF": b"\xAD",  # LATIN CAPITAL LETTER U WITH HORN
    "\u01B0": b"\xBD",  # LATIN SMALL LETTER U WITH HORN
    "\u01CD": b"\xE9\x41",  # LATIN CAPITAL LETTER A WITH CARON
    "\u01CE": b"\xE9\x61",  # LATIN SMALL LETTER A WITH CARON
    "\u01CF": b"\xE9\x49",  # LATIN CAPITAL LETTER I WITH CARON
    "\u01D0": b"\xE9\x69",  # LATIN SMALL LETTER I WITH CARON
    "\u01D1": b"\xE9\x4F",  # LATIN CAPITAL LETTER O WITH CARON
    "\u01D2": b"\xE9\x6F",  # LATIN SMALL LETTER O WITH CARON
    "\u01D3": b"\xE9\x55",  # LATIN CAPITAL LETTER U WITH CARON
    "\u01D4": b"\xE9\x75",  # LATIN SMALL LETTER U WITH CARON
    "\u01D5": b"\xE5\xE8\x55",  # LATIN CAPITAL LETTER U WITH DIAERESIS AND MACRON
    "\u01D6": b"\xE5\xE8\x75",  # LATIN SMALL LETTER U WITH DIAERESIS AND MACRON
    "\u01D7": b"\xE2\xE8\x55",  # LATIN CAPITAL LETTER U WITH DIAERESIS AND ACUTE
    "\u01D8": b"\xE2\xE8\x75",  # LATIN SMALL LETTER U WITH DIAERESIS AND ACUTE
    "\u01D9": b"\xE9\xE8\x55",  # LATIN CAPITAL LETTER U WITH DIAERESIS AND CARON
    "\u01DA": b"\xE9\xE8\x75",  # LATIN SMALL LETTER U WITH DIAERESIS AND CARON
    "\u01DB": b"\xE1\xE8\x55",  # LATIN CAPITAL LETTER U WITH DIAERESIS AND GRAVE
    "\u01DC": b"\xE1\xE8\x75",  # LATIN SMALL LETTER U WITH DIAERESIS AND GRAVE
    "\u01DE": b"\xE5\xE8\x41",  # LATIN CAPITAL LETTER A WITH DIAERESIS AND MACRON
    "\u01DF": b"\xE5\xE8\x61",  # LATIN SMALL LETTER A WITH DIAERESIS AND MACRON
    "\u01E0": b"\xE5\xE7\x41",  # LATIN CAPITAL LETTER A WITH DOT ABOVE AND MACRON
    "\u01E1": b"\xE5\xE7\x61",  # LATIN SMALL LETTER A WITH DOT ABOVE AND MACRON
    "\u01E2": b"\xE5\xA5",  # LATIN CAPITAL LETTER AE WITH MACRON
    "\u01E3": b"\xE5\xB5",  # LATIN SMALL LETTER AE WITH MACRON
    "\u01E6": b"\xE9\x47",  # LATIN CAPITAL LETTER G WITH CARON
    "\u01E7": b"\xE9\x67",  # LATIN SMALL LETTER G WITH CARON
    "\u01E8": b"\xE9\x4B",  # LATIN CAPITAL LETTER K WITH CARON
    "\u01E9": b"\xE9\x6B",  # LATIN SMALL LETTER K WITH CARON
    "\u01EA": b"\xF1\x4F",  # LATIN CAPITAL LETTER O WITH OGONEK
    "\u01EB": b"\xF1\x6F",  # LATIN SMALL LETTER O WITH OGONEK
    "\u01EC": b"\xE5\xF1\x4F",  # LATIN CAPITAL LETTER O WITH OGONEK AND MACRON
    "\u01ED": b"\xE5\xF1\x6F",  # LATIN SMALL LETTER O WITH OGONEK AND MACRON
    "\u01F0": b"\xE9\x6A",  # LATIN SMALL LETTER J WITH CARON
    "\u01F4": b"\xE2\x47",  # LATIN CAPITAL LETTER G WITH ACUTE
    "\u01F5": b"\xE2\x67",  # LATIN SMALL LETTER G WITH ACUTE
    "\u01F8": b"\xE1\x4E",  # LATIN CAPITAL LETTER N WITH GRAVE
    "\u01F9": b"\xE1\x6E",  # LATIN SMALL LETTER N WITH GRAVE
    "\u01FA": b"\xE2\xEA\x41",  # LATIN CAPITAL LETTER A WITH RING ABOVE AND ACUTE
    "\u01FB": b"\xE2\xEA\x61",  # LATIN SMALL LETTER A WITH RING ABOVE AND ACUTE
    "\u01FC": b"\xE2\xA5",  # LATIN CAPITAL LETTER AE WITH ACUTE
    "\u01FD": b"\xE2\xB5",  # LATIN SMALL LETTER AE WITH ACUTE
    "\u01FE": b"\xE2\xA2",  # LATIN CAPITAL LETTER O WITH STROKE AND ACUTE
    "\u01FF": b"\xE2\xB2",  # LATIN SMALL LETTER O WITH STROKE AND ACUTE
    "\u0218": b"\xF7\x53",  # LATIN CAPITAL LETTER S WITH COMMA BELOW
    "\u0219": b"\xF7\x73",  # LATIN SMALL LETTER S WITH COMMA BELOW
    "\u021A": b"\xF7\x54",  # LATIN CAPITAL LETTER T WITH COMMA BELOW
    "\u021B": b"\xF7\x74",  # LATIN SMALL LETTER T WITH COMMA BELOW
    "\u021E": b"\xE9\x48",  # LATIN CAPITAL LETTER H WITH CARON
    "\u021F": b"\xE9\x68",  # LATIN SMALL LETTER H WITH CARON
    "\u0226": b"\xE7\x41",  # LATIN CAPITAL LETTER A WITH DOT ABOVE
    "\u0227": b"\xE7\x61",  # LATIN SMALL LETTER A WITH DOT ABOVE
    "\u0228": b"\xF0\x45",  # LATIN CAPITAL LETTER E WITH CEDILLA
    "\u0229": b"\xF0\x65",  # LATIN SMALL LETTER E WITH CEDILLA
    "\u022A": b"\xE5\xE8\x4F",  # LATIN CAPITAL LETTER O WITH DIAERESIS AND MACRON
    "\u022B": b"\xE5\xE8\x6F",  # LATIN SMALL LETTER O WITH DIAERESIS AND MACRON
    "\u022C": b"\xE5\xE4\x4F",  # LATIN CAPITAL LETTER O WITH TILDE AND MACRON
    "\u022D": b"\xE5\xE4\x6F",  # LATIN SMALL LETTER O WITH TILDE AND MACRON
    "\u022E": b"\xE7\x4F",  # LATIN CAPITAL LETTER O WITH DOT ABOVE
    "\u022F": b"\xE7\x6F",  # LATIN SMALL LETTER O WITH DOT ABOVE
    "\u0230": b"\xE5\xE7\x4F",  # LATIN CAPITAL LETTER O WITH DOT ABOVE AND MACRON
    "\u0231": b"\xE5\xE7\x6F",  # LATIN SMALL LETTER O WITH DOT ABOVE AND MACRON
    "\u0232": b"\xE5\x59",  # LATIN CAPITAL LETTER Y WITH MACRON
    "\u0233": b"\xE5\x79",  # LATIN SMALL LETTER Y WITH MACRON
    "\u02B9": b"\xA7",  # MODIFIER LETTER PRIME
    "\u02BA": b"\xB7",  # MODIFIER LETTER DOUBLE PRIME
    "\u02BB": b"\xB0",  # MODIFIER LETTER TURNED COMMA
    "\u02BC": b"\xAE",  # MODIFIER LETTER APOSTROPHE
    "\u0374": b"\xA7",  # GREEK NUMERAL SIGN
    "\u037E": b"\x3B",  # GREEK QUESTION MARK
    "\u0387": b"\xA8",  # GREEK ANO TELEIA
    "\u1E00": b"\xF4\x41",  # LATIN CAPITAL LETTER A WITH RING BELOW
    "\u1E01": b"\xF4\x61",  # LATIN SMALL LETTER A WITH RING BELOW
    "\u1E02": b"\xE7\x42",  # LATIN CAPITAL LETTER B WITH DOT ABOVE
    "\u1E03": b"\xE7\x62",  # LATIN SMALL LETTER B WITH DOT ABOVE
    "\u1E04": b"\xF2\x42",  # LATIN CAPITAL LETTER B WITH DOT BELOW
    "\u1E05": b"\xF2\x62",  # LATIN SMALL LETTER B WITH DOT BELOW
    "\u1E08": b"\xE2\xF0\x43",  # LATIN CAPITAL LETTER C WITH CEDILLA AND ACUTE
    "\u1E09": b"\xE2\xF0\x63",  # LATIN SMALL LETTER C WITH CEDILLA AND ACUTE
    "\u1E0A": b"\xE7\x44",  # LATIN CAPITAL LETTER D WITH DOT ABOVE
    "\u1E0B": b"\xE7\x64",  # LATIN SMALL LETTER D WITH DOT ABOVE
    "\u1E0C": b"\xF2\x44",  # LATIN CAPITAL LETTER D WITH DOT BELOW
    "\u1E0D": b"\xF2\x64",  # LATIN SMALL LETTER D WITH DOT BELOW
    "\u1E10": b"\xF0\x44",  # LATIN CAPITAL LETTER D WITH CEDILLA
    "\u1E11": b"\xF0\x64",  # LATIN SMALL LETTER D WITH CEDILLA
    "\u1E14": b"\xE1\xE5\x45",  # LATIN CAPITAL LETTER E WITH MACRON AND GRAVE
    "\u1E15": b"\xE1\xE5\x65",  # LATIN SMALL LETTER E WITH MACRON AND GRAVE
    "\u1E16": b"\xE2\xE5\x45",  # LATIN CAPITAL LETTER E WITH MACRON AND ACUTE
    "\u1E17": b"\xE2\xE5\x65",  # LATIN SMALL LETTER E WITH MACRON AND ACUTE
    "\u1E1C": b"\xE6\xF0\x45",  # LATIN CAPITAL LETTER E WITH CEDILLA AND BREVE
    "\u1E1D": b"\xE6\xF0\x65",  # LATIN SMALL LETTER E WITH CEDILLA AND BREVE
    "\u1E1E": b"\xE7\x46",  # LATIN CAPITAL LETTER F WITH DOT ABOVE
    "\u1E1F": b"\xE7\x66",  # LATIN SMALL LETTER F WITH DOT ABOVE
    "\u1E20": b"\xE5\x47",  # LATIN CAPITAL LETTER G WITH MACRON
    "\u1E21": b"\xE5\x67",  # LATIN SMALL LETTER G WITH MACRON
    "\u1E22": b"\xE7\x48",  # LATIN CAPITAL LETTER H WITH DOT ABOVE
    "\u1E23": b"\xE7\x68",  # LATIN SMALL LETTER H WITH DOT ABOVE
    "\u1E24": b"\xF2\x48",  # LATIN CAPITAL LETTER H WITH DOT BELOW
    "\u1E25": b"\xF2\x68",  # LATIN SMALL LETTER H WITH DOT BELOW
    "\u1E26": b"\xE8\x48",  # LATIN CAPITAL LETTER H WITH DIAERESIS
    "\u1E27": b"\xE8\x68",  # LATIN SMALL LETTER H WITH DIAERESIS
    "\u1E28": b"\xF0\x48",  # LATIN CAPITAL LETTER H WITH CEDILLA
    "\u1E29": b"\xF0\x68",  # LATIN SMALL LETTER H WITH CEDILLA
    "\u1E2A": b"\xF9\x48",  # LATIN CAPITAL LETTER H WITH BREVE BELOW
    "\u1E2B": b"\xF9\x68",  # LATIN SMALL LETTER H WITH BREVE BELOW
    "\u1E2E": b"\xE2\xE8\x49",  # LATIN CAPITAL LETTER I WITH DIAERESIS AND ACUTE
    "\u1E2F": b"\xE2\xE8\x69",  # LATIN SMALL LETTER I WITH DIAERESIS AND ACUTE
    "\u1E30": b"\xE2\x4B",  # LATIN CAPITAL LETTER K WITH ACUTE
    "\u1E31": b"\xE2\x6B",  # LATIN SMALL LETTER K WITH ACUTE
    "\u1E32": b"\xF2\x4B",  # LATIN CAPITAL LETTER K WITH DOT BELOW
    "\u1E33": b"\xF2\x6B",  # LATIN SMALL LETTER K WITH DOT BELOW
    "\u1E36": b"\xF2\x4C",  # LATIN CAPITAL LETTER L WITH DOT BELOW
    "\u1E37": b"\xF2\x6C",  # LATIN SMALL LETTER L WITH DOT BELOW
    "\u1E38": b"\xE5\xF2\x4C",  # LATIN CAPITAL LETTER L WITH DOT BELOW AND MACRON
    "\u1E39": b"\xE5\xF2\x6C",  # LATIN SMALL LETTER L WITH DOT BELOW AND MACRON
    "\u1E3E": b"\xE2\x4D",  # LATIN CAPITAL LETTER M WITH ACUTE
    "\u1E3F": b"\xE2\x6D",  # LATIN SMALL LETTER M WITH ACUTE
    "\u1E40": b"\xE7\x4D",  # LATIN CAPITAL LETTER M WITH DOT ABOVE
    "\u1E41": b"\xE7\x6D",  # LATIN SMALL LETTER M WITH DOT ABOVE
    "\u1E42": b"\xF2\x4D",  # LATIN CAPITAL LETTER M WITH DOT BELOW
    "\u1E43": b"\xF2\x6D",  # LATIN SMALL LETTER M WITH DOT BELOW
    "\u1E44": b"\xE7\x4E",  # LATIN CAPITAL LETTER N WITH DOT ABOVE
    "\u1E45": b"\xE7\x6E",  # LATIN SMALL LETTER N WITH DOT ABOVE
    "\u1E46": b"\xF2\x4E",  # LATIN CAPITAL LETTER N WITH DOT BELOW
    "\u1E47": b"\xF2\x6E",  # LATIN SMALL LETTER N WITH DOT BELOW
    "\u1E4C": b"\xE2\xE4\x4F",  # LATIN CAPITAL LETTER O WITH TILDE AND ACUTE
    "\u1E4D": b"\xE2\xE4\x6F",  # LATIN SMALL LETTER O WITH TILDE AND ACUTE
    "\u1E4E": b"\xE8\xE4\x4F",  # LATIN CAPITAL LETTER O WITH TILDE AND DIAERESIS
    "\u1E4F": b"\xE8\xE4\x6F",  # LATIN SMALL LETTER O WITH TILDE AND DIAERESIS
    "\u1E50": b"\xE1\xE5\x4F",  # LATIN CAPITAL LETTER O WITH MACRON AND GRAVE
    "\u1E51": b"\xE1\xE5\x6F",  # LATIN SMALL LETTER O WITH MACRON AND GRAVE
    "\u1E52": b"\xE2\xE5\x4F",  # LATIN CAPITAL LETTER O WITH MACRON AND ACUTE
    "\u1E53": b"\xE2\xE5\x6F",  # LATIN SMALL LETTER O WITH MACRON AND ACUTE
    "\u1E54": b"\xE2\x50",  # LATIN CAPITAL LETTER P WITH ACUTE
    "\u1E55": b"\xE2\x70",  # LATIN SMALL LETTER P WITH ACUTE
    "\u1E56": b"\xE7\x50",  # LATIN CAPITAL LETTER P WITH DOT ABOVE
    "\u1E57": b"\xE7\x70",  # LATIN SMALL LETTER P WITH DOT ABOVE
    "\u1E58": b"\xE7\x52",  # LATIN CAPITAL LETTER R WITH DOT ABOVE
    "\u1E59": b"\xE7\x72",  # LATIN SMALL LETTER R WITH DOT ABOVE
    "\u1E5A": b"\xF2\x52",  # LATIN CAPITAL LETTER R WITH DOT BELOW
    "\u1E5B": b"\xF2\x72",  # LATIN SMALL LETTER R WITH DOT BELOW
    "\u1E5C": b"\xE5\xF2\x52",  # LATIN CAPITAL LETTER R WITH DOT BELOW AND MACRON
    "\u1E5D": b"\xE5\xF2\x72",  # LATIN SMALL LETTER R WITH DOT BELOW AND MACRON
    "\u1E60": b"\xE7\x53",  # LATIN CAPITAL LETTER S WITH DOT ABOVE
    "\u1E61": b"\xE7\x73",  # LATIN SMALL LETTER S WITH DOT ABOVE
    "\u1E62": b"\xF2\x53",  # LATIN CAPITAL LETTER S WITH DOT BELOW
    "\u1E63": b"\xF2\x73",  # LATIN SMALL LETTER S WITH DOT BELOW
    "\u1E64": b"\xE7\xE2\x53",  # LATIN CAPITAL LETTER S WITH ACUTE AND DOT ABOVE
    "\u1E65": b"\xE7\xE2\x73",  # LATIN SMALL LETTER S WITH ACUTE AND DOT ABOVE
    "\u1E66": b"\xE7\xE9\x53",  # LATIN CAPITAL LETTER S WITH CARON AND DOT ABOVE
    "\u1E67": b"\xE7\xE9\x73",  # LATIN SMALL LETTER S WITH CARON AND DOT ABOVE
    "\u1E68": b"\xE7\xF2\x53",  # LATIN CAPITAL LETTER S WITH DOT BELOW AND DOT ABOVE
    "\u1E69": b"\xE7\xF2\x73",  # LATIN SMALL LETTER S WITH DOT BELOW AND DOT ABOVE
    "\u1E6A": b"\xE7\x54",  # LATIN CAPITAL LETTER T WITH DOT ABOVE
    "\u1E6B": b"\xE7\x74",  # LATIN SMALL LETTER T WITH DOT ABOVE
    "\u1E6C": b"\xF2\x54",  # LATIN CAPITAL LETTER T WITH DOT BELOW
    "\u1E6D": b"\xF2\x74",  # LATIN SMALL LETTER T WITH DOT BELOW
    "\u1E72": b"\xF3\x55",  # LATIN CAPITAL LETTER U WITH DIAERESIS BELOW
    "\u1E73": b"\xF3\x75",  # LATIN SMALL LETTER U WITH DIAERESIS BELOW
    "\u1E78": b"\xE2\xE4\x55",  # LATIN CAPITAL LETTER U WITH TILDE AND ACUTE
    "\u1E79": b"\xE2\xE4\x75",  # LATIN SMALL LETTER U WITH TILDE AND ACUTE
    "\u1E7A": b"\xE8\xE5\x55",  # LATIN CAPITAL LETTER U WITH MACRON AND DIAERESIS
    "\u1E7B": b"\xE8\xE5\x75",  # LATIN SMALL LETTER U WITH MACRON AND DIAERESIS
    "\u1E7C": b"\xE4\x56",  # LATIN CAPITAL LETTER V WITH TILDE
    "\u1E7D": b"\xE4\x76",  # LATIN SMALL LETTER V WITH TILDE
    "\u1E7E": b"\xF2\x56",  # LATIN CAPITAL LETTER V WITH DOT BELOW
    "\u1E7F": b"\xF2\x76",  # LATIN SMALL LETTER V WITH DOT BELOW
    "\u1E80": b"\xE1\x57",  # LATIN CAPITAL LETTER W WITH GRAVE
    "\u1E81": b"\xE1\x77",  # LATIN SMALL LETTER W WITH GRAVE
    "\u1E82": b"\xE2\x57",  # LATIN CAPITAL LETTER W WITH ACUTE
    "\u1E83": b"\xE2\x77",  # LATIN SMALL LETTER W WITH ACUTE
    "\u1E84": b"\xE8\x57",  # LATIN CAPITAL LETTER W WITH DIAERESIS
    "\u1E85": b"\xE8\x77",  # LATIN SMALL LETTER W WITH DIAERESIS
    "\u1E86": b"\xE7\x57",  # LATIN CAPITAL LETTER W WITH DOT ABOVE
    "\u1E87": b"\xE7\x77",  # LATIN SMALL LETTER W WITH DOT ABOVE
    "\u1E88": b"\xF2\x57",  # LATIN CAPITAL LETTER W WITH DOT BELOW
    "\u1E89": b"\xF2\x77",  # LATIN SMALL LETTER W WITH DOT BELOW
    "\u1E8A": b"\xE7\x58",  # LATIN CAPITAL LETTER X WITH DOT ABOVE
    "\u1E8B": b"\xE7\x78",  # LATIN SMALL LETTER X WITH DOT ABOVE
    "\u1E8C": b"\xE8\x58",  # LATIN CAPITAL LETTER X WITH DIAERESIS
    "\u1E8D": b"\xE8\x78",  # LATIN SMALL LETTER X WITH DIAERESIS
    "\u1E8E": b"\xE7\x59",  # LATIN CAPITAL LETTER Y WITH DOT ABOVE
    "\u1E8F": b"\xE7\x79",  # LATIN SMALL LETTER Y WITH DOT ABOVE
    "\u1E90": b"\xE3\x5A",  # LATIN CAPITAL LETTER Z WITH CIRCUMFLEX
    "\u1E91": b"\xE3\x7A",  # LATIN SMALL LETTER Z WITH CIRCUMFLEX
    "\u1E92": b"\xF2\x5A",  # LATIN CAPITAL LETTER Z WITH DOT BELOW
    "\u1E93": b"\xF2\x7A",  # LATIN SMALL LETTER Z WITH DOT BELOW
    "\u1E97": b"\xE8\x74",  # LATIN SMALL LETTER T WITH DIAERESIS
    "\u1E98": b"\xEA\x77",  # LATIN SMALL LETTER W WITH RING ABOVE
    "\u1E99": b"\xEA\x79",  # LATIN SMALL LETTER Y WITH RING ABOVE
    "\u1EA0": b"\xF2\x41",  # LATIN CAPITAL LETTER A WITH DOT BELOW
    "\u1EA1": b"\xF2\x61",  # LATIN SMALL LETTER A WITH DOT BELOW
    "\u1EA2": b"\xE0\x41",  # LATIN CAPITAL LETTER A WITH HOOK ABOVE
    "\u1EA3": b"\xE0\x61",  # LATIN SMALL LETTER A WITH HOOK ABOVE
    "\u1EA4": b"\xE2\xE3\x41",  # LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE
    "\u1EA5": b"\xE2\xE3\x61",  # LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE
    "\u1EA6": b"\xE1\xE3\x41",  # LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE
    "\u1EA7": b"\xE1\xE3\x61",  # LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE
    "\u1EA8": b"\xE0\xE3\x41",  # LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE
    "\u1EA9": b"\xE0\xE3\x61",  # LATIN SMALL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE
    "\u1EAA": b"\xE4\xE3\x41",  # LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE
    "\u1EAB": b"\xE4\xE3\x61",  # LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE
    "\u1EAC": b"\xE3\xF2\x41",  # LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW
    "\u1EAD": b"\xE3\xF2\x61",  # LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW
    "\u1EAE": b"\xE2\xE6\x41",  # LATIN CAPITAL LETTER A WITH BREVE AND ACUTE
    "\u1EAF": b"\xE2\xE6\x61",  # LATIN SMALL LETTER A WITH BREVE AND ACUTE
    "\u1EB0": b"\xE1\xE6\x41",  # LATIN CAPITAL LETTER A WITH BREVE AND GRAVE
    "\u1EB1": b"\xE1\xE6\x61",  # LATIN SMALL LETTER A WITH BREVE AND GRAVE
    "\u1EB2": b"\xE0\xE6\x41",  # LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE
    "\u1EB3": b"\xE0\xE6\x61",  # LATIN SMALL LETTER A WITH BREVE AND HOOK ABOVE
    "\u1EB4": b"\xE4\xE6\x41",  # LATIN CAPITAL LETTER A WITH BREVE AND TILDE
    "\u1EB5": b"\xE4\xE6\x61",  # LATIN SMALL LETTER A WITH BREVE AND TILDE
    "\u1EB6": b"\xE6\xF2\x41",  # LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW
    "\u1EB7": b"\xE6\xF2\x61",  # LATIN SMALL LETTER A WITH BREVE AND DOT BELOW
    "\u1EB8": b"\xF2\x45",  # LATIN CAPITAL LETTER E WITH DOT BELOW
    "\u1EB9": b"\xF2\x65",  # LATIN SMALL LETTER E WITH DOT BELOW
    "\u1EBA": b"\xE0\x45",  # LATIN CAPITAL LETTER E WITH HOOK ABOVE
    "\u1EBB": b"\xE0\x65",  # LATIN SMALL LETTER E WITH HOOK ABOVE
    "\u1EBC": b"\xE4\x45",  # LATIN CAPITAL LETTER E WITH TILDE
    "\u1EBD": b"\xE4\x65",  # LATIN SMALL LETTER E WITH TILDE
    "\u1EBE": b"\xE2\xE3\x45",  # LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE
    "\u1EBF": b"\xE2\xE3\x65",  # LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE
    "\u1EC0": b"\xE1\xE3\x45",  # LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE
    "\u1EC1": b"\xE1\xE3\x65",  # LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE
    "\u1EC2": b"\xE0\xE3\x45",  # LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE
    "\u1EC3": b"\xE0\xE3\x65",  # LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE
    "\u1EC4": b"\xE4\xE3\x45",  # LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE
    "\u1EC5": b"\xE4\xE3\x65",  # LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE
    "\u1EC6": b"\xE3\xF2\x45",  # LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW
    "\u1EC7": b"\xE3\xF2\x65",  # LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW
    "\u1EC8": b"\xE0\x49",  # LATIN CAPITAL LETTER I WITH HOOK ABOVE
    "\u1EC9": b"\xE0\x69",  # LATIN SMALL LETTER I WITH HOOK ABOVE
    "\u1ECA": b"\xF2\x49",  # LATIN CAPITAL LETTER I WITH DOT BELOW
    "\u1ECB": b"\xF2\x69",  # LATIN SMALL LETTER I WITH DOT BELOW
    "\u1ECC": b"\xF2\x4F",  # LATIN CAPITAL LETTER O WITH DOT BELOW
    "\u1ECD": b"\xF2\x6F",  # LATIN SMALL LETTER O WITH DOT BELOW
    "\u1ECE": b"\xE0\x4F",  # LATIN CAPITAL LETTER O WITH HOOK ABOVE
    "\u1ECF": b"\xE0\x6F",  # LATIN SMALL LETTER O WITH HOOK ABOVE
    "\u1ED0": b"\xE2\xE3\x4F",  # LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE
    "\u1ED1": b"\xE2\xE3\x6F",  # LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE
    "\u1ED2": b"\xE1\xE3\x4F",  # LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE
    "\u1ED3": b"\xE1\xE3\x6F",  # LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE
    "\u1ED4": b"\xE0\xE3\x4F",  # LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE
    "\u1ED5": b"\xE0\xE3\x6F",  # LATIN SMALL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE
    "\u1ED6": b"\xE4\xE3\x4F",  # LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE
    "\u1ED7": b"\xE4\xE3\x6F",  # LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE
    "\u1ED8": b"\xE3\xF2\x4F",  # LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW
    "\u1ED9": b"\xE3\xF2\x6F",  # LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELOW
    "\u1EE4": b"\xF2\x55",  # LATIN CAPITAL LETTER U WITH DOT BELOW
    "\u1EE5": b"\xF2\x75",  # LATIN SMALL LETTER U WITH DOT BELOW
    "\u1EE6": b"\xE0\x55",  # LATIN CAPITAL LETTER U WITH HOOK ABOVE
    "\u1EE7": b"\xE0\x75",  # LATIN SMALL LETTER U WITH HOOK ABOVE
    "\u1EF2": b"\xE1\x59",  # LATIN CAPITAL LETTER Y WITH GRAVE
    "\u1EF3": b"\xE1\x79",  # LATIN SMALL LETTER Y WITH GRAVE
    "\u1EF4": b"\xF2\x59",  # LATIN CAPITAL LETTER Y WITH DOT BELOW
    "\u1EF5": b"\xF2\x79",  # LATIN SMALL LETTER Y WITH DOT BELOW
    "\u1EF6": b"\xE0\x59",  # LATIN CAPITAL LETTER Y WITH HOOK ABOVE
    "\u1EF7": b"\xE0\x79",  # LATIN SMALL LETTER Y WITH HOOK ABOVE
    "\u1EF8": b"\xE4\x59",  # LATIN CAPITAL LETTER Y WITH TILDE
    "\u1EF9": b"\xE4\x79",  # LATIN SMALL LETTER Y WITH TILDE
    "\u1FEF": b"\x60",  # GREEK VARIA
    "\u2113": b"\xC1",  # SCRIPT SMALL L
    "\u2117": b"\xC2",  # SOUND RECORDING COPYRIGHT
    "\u212A": b"\x4B",  # KELVIN SIGN
    "\u212B": b"\xEA\x41",  # ANGSTROM SIGN
    "\u266D": b"\xA9",  # MUSIC FLAT SIGN
    "\u266F": b"\xC4",  # MUSIC SHARP SIGN
}

UNICODE_TO_ANSEL_MODIFIERS = {
    "\u0300": b"\xE1",  # COMBINING GRAVE ACCENT
    "\u0301": b"\xE2",  # COMBINING ACUTE ACCENT
    "\u0302": b"\xE3",  # COMBINING CIRCUMFLEX ACCENT
    "\u0303": b"\xE4",  # COMBINING TILDE
    "\u0304": b"\xE5",  # COMBINING MACRON
    "\u0306": b"\xE6",  # COMBINING BREVE
    "\u0307": b"\xE7",  # COMBINING DOT ABOVE
    "\u0308": b"\xE8",  # COMBINING DIAERESIS
    "\u0309": b"\xE0",  # COMBINING HOOK ABOVE
    "\u030A": b"\xEA",  # COMBINING RING ABOVE
    "\u030B": b"\xEE",  # COMBINING DOUBLE ACUTE ACCENT
    "\u030C": b"\xE9",  # COMBINING CARON
    "\u0310": b"\xEF",  # COMBINING CANDRABINDU
    "\u0313": b"\xFE",  # COMBINING COMMA ABOVE
    "\u0315": b"\xED",  # COMBINING COMMA ABOVE RIGHT
    "\u031C": b"\xF8",  # COMBINING LEFT HALF RING BELOW
    "\u0323": b"\xF2",  # COMBINING DOT BELOW
    "\u0324": b"\xF3",  # COMBINING DIAERESIS BELOW
    "\u0325": b"\xF4",  # COMBINING RING BELOW
    "\u0326": b"\xF7",  # COMBINING COMMA BELOW
    "\u0327": b"\xF0",  # COMBINING CEDILLA
    "\u0328": b"\xF1",  # COMBINING OGONEK
    "\u032E": b"\xF9",  # COMBINING BREVE BELOW
    "\u0332": b"\xF6",  # COMBINING LOW LINE
    "\u0333": b"\xF5",  # COMBINING DOUBLE LOW LINE
    "\u0340": b"\xE1",  # COMBINING GRAVE TONE MARK
    "\u0341": b"\xE2",  # COMBINING ACUTE TONE MARK
    "\u0343": b"\xFE",  # COMBINING GREEK KORONIS
    "\u0344": b"\xE2\xE8",  # COMBINING GREEK DIALYTIKA TONOS
    "\uFE20": b"\xEB",  # COMBINING LIGATURE LEFT HALF
    "\uFE21": b"\xEC",  # COMBINING LIGATURE RIGHT HALF
    "\uFE22": b"\xFA",  # COMBINING DOUBLE TILDE LEFT HALF
    "\uFE23": b"\xFB",  # COMBINING DOUBLE TILDE RIGHT HALF
}


class Codec(codec.Codec):
    name = "ansel"
    encode_char_map = UNICODE_TO_ANSEL
    encode_modifier_map = UNICODE_TO_ANSEL_MODIFIERS
    decode_char_map = ANSEL_TO_UNICODE
    decode_control_map = ANSEL_TO_UNICODE_CONTROL
    decode_modifier_map = ANSEL_TO_UNICODE_MODIFIERS


class IncrementalDecoder(incremental.IncrementalDecoder):
    name = "ansel"
    decode_char_map = ANSEL_TO_UNICODE
    decode_control_map = ANSEL_TO_UNICODE_CONTROL
    decode_modifier_map = ANSEL_TO_UNICODE_MODIFIERS


class IncrementalEncoder(incremental.IncrementalEncoder):
    name = "ansel"
    encode_char_map = UNICODE_TO_ANSEL
    encode_modifier_map = UNICODE_TO_ANSEL_MODIFIERS


class StreamReader(Codec, codecs.StreamReader):
    pass


class StreamWriter(Codec, codecs.StreamWriter):
    pass


def getregentry():
    return codecs.CodecInfo(
        name="ansel",
        encode=Codec().encode,
        decode=Codec().decode,
        incrementalencoder=IncrementalEncoder,
        incrementaldecoder=IncrementalDecoder,
        streamreader=StreamReader,
        streamwriter=StreamWriter,
    )
