Handle non-ascii characters when generating fuzzing dictionary

This caused a failure when generating the dictionary for `tree-sitter-agda`.
This commit is contained in:
Phil Turnbull 2019-10-24 10:11:32 -04:00
parent 71d8d79425
commit f019cb2f0e
No known key found for this signature in database
GPG key ID: D81B30C00789D262

View file

@ -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()