From f019cb2f0e3604b264aeb55a3a01641f998d27d7 Mon Sep 17 00:00:00 2001 From: Phil Turnbull Date: Thu, 24 Oct 2019 10:11:32 -0400 Subject: [PATCH] Handle non-ascii characters when generating fuzzing dictionary This caused a failure when generating the dictionary for `tree-sitter-agda`. --- test/fuzz/gen-dict.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fuzz/gen-dict.py b/test/fuzz/gen-dict.py index a9e07838..f8cf834e 100644 --- a/test/fuzz/gen-dict.py +++ b/test/fuzz/gen-dict.py @@ -25,7 +25,7 @@ def main(): for lit in sorted(literals): if lit: - print '"%s"' % ''.join([(c if c.isalnum() else '\\x%02x' % ord(c)) for c in lit]) + print '"%s"' % ''.join(['\\x%02x' % ord(b) for b in lit.encode('utf-8')]) if __name__ == '__main__': main()