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: else:
token = codecs.getencoder('utf8')(token)[0] token = codecs.getencoder('utf8')(token)[0]
token = codecs.getdecoder('unicode_escape')(token)[0] token = codecs.getdecoder('unicode_escape')(token)[0]
try:
token = token.encode('iso-8859-1').decode() token = token.encode('iso-8859-1').decode()
except: # Prevent issue with tokens like '"\\x80"'.
pass
return token return token
def _insideBrackets(self, lexer): def _insideBrackets(self, lexer):