jkuhlmann / cgltf

:diamond_shape_with_a_dot_inside: Single-file glTF 2.0 loader and writer written in C99
MIT License
1.44k stars 136 forks source link

Handling escaped json strings #163

Closed pezcode closed 2 years ago

pezcode commented 2 years ago

:wave:

cgltf doesn't decode encoded json strings, leaving escaped characters (some whitespace, unicode codepoints, etc.) in names. I've implemented this outside of cgltf, but I feel like this is inherently a library task to deal with the underlying format's string encoding.

Would you accept a PR that adds a function to perform the string decoding? This would be an entirely optional function to use in-place (similar to cgltf_decode_uri) on user-facing strings (mostly names and URIs). The glTF spec guarantees that a valid glTF file doesn't use encoded strings for keys and enums, so no changes needed to parsing code.

For reference, the allowed escape characters:

jkuhlmann commented 2 years ago

Sure, that sounds like a good idea. Feel free to submit a PR for that. :+1:

jkuhlmann commented 2 years ago

PR adding this is merged. Thank you!