utils.str: Prevent issue with tokens like '\x80' in Python 3.

This commit is contained in:
Valentin Lorentz 2013-01-23 15:48:24 +01:00
parent b421120bad
commit 2ace534bdb

View File

@ -307,7 +307,10 @@ class Tokenizer(object):
else:
token = codecs.getencoder('utf8')(token)[0]
token = codecs.getdecoder('unicode_escape')(token)[0]
token = token.encode('iso-8859-1').decode()
try:
token = token.encode('iso-8859-1').decode()
except: # Prevent issue with tokens like '"\\x80"'.
pass
return token
def _insideBrackets(self, lexer):