OTM2 uses a copy+pasted version of _sanitize_unicode_record to export JSON values. Consider unit testing this function and publicly exporting it.