From d7a6b01d8a45a9b816a87ca5b9d15d4784ac29e9 Mon Sep 17 00:00:00 2001 From: night199uk Date: Sun, 14 Oct 2018 14:56:42 +0200 Subject: [PATCH] Ensure that Exceptions with Unicode content display correctly --- lark/exceptions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lark/exceptions.py b/lark/exceptions.py index f3642ac..57eff9d 100644 --- a/lark/exceptions.py +++ b/lark/exceptions.py @@ -66,7 +66,7 @@ class UnexpectedCharacters(LexError, UnexpectedInput): if allowed: message += '\nExpecting: %s\n' % allowed - super(UnexpectedCharacters, self).__init__(message) + super(UnexpectedCharacters, self).__init__(message.encode('utf-8')) @@ -84,6 +84,6 @@ class UnexpectedToken(ParseError, UnexpectedInput): "Expected one of: \n\t* %s\n" % (token, self.line, self.column, '\n\t* '.join(self.expected))) - super(UnexpectedToken, self).__init__(message) + super(UnexpectedToken, self).__init__(message.encode('utf-8')) ###}