Closed 20urc3 closed 3 months ago
This allow to compile out-of-the-shelf the javascript.json using: make GRAMMAR_FILE=grammars/javascript.json
(which was broken until now and was returning
UnicodeEncodeError: 'latin-1' codec can't encode character '\u2421' in position 0: ordinal not in range(256)
make: *** [GNUmakefile:102: src/f1_c_fuzz.c] Error 1
thank you!
Fix #46
This commit addresses a UnicodeEncodeError that occurred when attempting to serialize TreeNode objects containing Unicode characters outside the Latin-1 range (0-255). The specific error was triggered by the character '\u2421'.
Changes:
Modified TreeNode.to_bytes() method:
Updated TreeNode.from_bytes() method:
These modifications allow the serialization and deserialization of TreeNode objects containing any valid Unicode character, resolving the UnicodeEncodeError while maintaining compatibility with the existing byte structure.
Note: This change may slightly increase the size of serialized data for non-ASCII characters, but it ensures correct handling of all Unicode characters in the grammar.