  	struct perf_data_convert_opts opts = {
  		.force = false,
  		.all = false,
-@@ -63,6 +65,7 @@ static int cmd_data_convert(int argc, const char **argv)
+@@ -63,6 +63,7 @@ static int cmd_data_convert(int argc, const char **argv)
  	const struct option options[] = {
  		OPT_INCR('v', "verbose", &verbose, "be more verbose"),
  		OPT_STRING('i', "input", &input_name, "file", "input file name"),

+		switch (*s) {
+
+		// required escapes with special forms as per RFC 8259
+		case '"':  fprintf(out, "\\\""); break;
+		case '\\': fprintf(out, "\\\\"); break;
+		case '/':  fprintf(out, "\\/");  break;
+		case '\b': fprintf(out, "\\b");  break;
+		case '\f': fprintf(out, "\\f");  break;
+		case '\n': fprintf(out, "\\n");  break;
+		case '\r': fprintf(out, "\\r");  break;
+		case '\t': fprintf(out, "\\t");  break;
+
+		default:
+			// all other control characters must be escaped by hex code
+			if (*s <= 0x1f) {
+				fprintf(out, "\\u%04x", *s);
+			} else {
+				fputc(*s, out);
+			}
+			break;
+		}
+

+#include "util/dso.h"
+#include "util/event.h"
+#include "util/evsel.h"
+#include "util/evlist.h"
+#include "util/header.h"
+#include "util/map.h"
+#include "util/session.h"
