Archived
We hadn't bothered, as this was just example-like code to show how one could convert from CBOR to JSON. But as it was added to the library (no extra dependency), we should Do The Right Thing (DTRT) and escape. This patch could have used cbor_value_to_pretty() to print the string, which has better support for UTF-8 escaping and thus checks for UTF-8 correctness, but that would make map_to_json()'s metadata functionality much more complex, especially since we cannot rely on open_memstream() always being available. Therefore, we are partially duplicating cborpretty.c's utf8EscapedDump(). Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>