static void pair_str(const char *key, const char *val, int mode, int last) {
	if (IS_MODE_JSON (mode)) {
		if (!val) {
			val = "";
		}
		char *encval = r_str_escape_utf8_for_json (val, -1);
		if (encval) {
			char *qs = r_str_newf ("\"%s\"", encval);
			pair (key, qs, mode, last);
			free (encval);
			free (qs);
		}
	} else {
		pair (key, val, mode, last);
	}
}
static void pair_str(const char *key, const char *val, int mode, int last) {
	if (IS_MODE_JSON (mode)) {
		if (!val) {
			val = "";
		}
		char *encval = r_str_escape_utf8_for_json (val, -1);
		if (encval) {
			char *qs = r_str_newf ("\"%s\"", encval);
			pair (key, qs, mode, last);
			free (encval);
			free (qs);
		}
	} else {
		pair (key, val, mode, last);
	}
}