    def test_ansi_terminal_parser_errors(self):
        """
        Check AnsiTerminalParser handles unsupported encodings gracefully.
        """
        parser = AnsiTerminalParser()
        parser.reset("a\x1BZb\x01c", None)
        tokens = parser.parse()

        # Ignore unknown escape and next letter
        self.assertEqual(next(tokens), (0, Parser.DISPLAY_TEXT, "a"))
        self.assertEqual(next(tokens), (1, Parser.DISPLAY_TEXT, "b"))

        # ANSI art uses control codes for special characters - check we just blank them.
        self.assertEqual(next(tokens), (4, Parser.DISPLAY_TEXT, " "))

        # Back to normal.
        self.assertEqual(next(tokens), (5, Parser.DISPLAY_TEXT, "c"))
Check AnsiTerminalParser handles unsupported encodings gracefully.
tests/test_parsers.py