574 length = 3 |
574 length = 3 |
575 elif data[index] & 0b11000000 == 0b11000000: |
575 elif data[index] & 0b11000000 == 0b11000000: |
576 length = 2 |
576 length = 2 |
577 else: |
577 else: |
578 length = 1 |
578 length = 1 |
579 txt = data[index : index + length].decode("utf8") |
579 try: |
|
580 txt = data[index : index + length].decode("utf8") |
|
581 except UnicodeDecodeError: |
|
582 txt = data[index : index + length].decode("iso8859-1") |
580 index += length - 1 # one more is done at the end |
583 index += length - 1 # one more is done at the end |
581 self.insertPlainText(txt) |
584 self.insertPlainText(txt) |
582 |
585 |
583 index += 1 |
586 index += 1 |
584 |
587 |