callbacks.py: Fix error with commands like @echo "¡".

This commit is contained in:
Valentin Lorentz 2012-11-07 19:20:26 +01:00
parent 25855e5547
commit d9f2235aed

View File

@ -285,7 +285,15 @@ class Tokenizer(object):
if token[0] == token[-1] and token[0] in self.quotes:
token = token[1:-1]
encoding_prefix = 'string' if sys.version_info[0]<3 else 'unicode'
token = token.encode().decode(encoding_prefix + '_escape')
# FIXME: No need to tell you this is a hack.
# It has to handle both IRC commands and serialized configuration.
try:
token = token.decode(encoding_prefix + '_escape')
except:
try:
token = token.encode().decode(encoding_prefix + '_escape')
except:
pass
return token
def _insideBrackets(self, lexer):