fix #11, EUC-TW encoding exception

This commit is contained in:
Rossen Georgiev 2016-01-19 07:18:14 +00:00
parent ca8e3f84a9
commit ba395385a0
2 changed files with 8 additions and 1 deletions

View File

@ -1,6 +1,13 @@
CHANGES
-------
# 0.6.42
- added parsing for WX (positionless and in comment)
- fix exception due to EUC-TW encoding, #11
# LOTS OF MINOR STUFF
# v0.6.37
- charset detection, unicode for all

View File

@ -74,7 +74,7 @@ def _unicode_packet(packet):
# attempt to detect encoding
res = chardet.detect(packet.split(b':', 1)[-1])
if res['confidence'] > 0.7:
if res['confidence'] > 0.7 and res['encoding'] != 'EUC-TW':
try:
return packet.decode(res['encoding'])
except UnicodeDecodeError: