Skip to content

Commit bf88c73

Browse files
rain-1nicowilliams
authored andcommitted
src/main.c: fix issue jqlang#1587 by using jv_dumpf in the raw-output and ascii-output case. retain fwrite in the raw-output case.
1 parent ae11f11 commit bf88c73

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,11 @@ static int process(jq_state *jq, jv value, int flags, int dumpopts) {
167167
jv result;
168168
while (jv_is_valid(result = jq_next(jq))) {
169169
if ((options & RAW_OUTPUT) && jv_get_kind(result) == JV_KIND_STRING) {
170-
fwrite(jv_string_value(result), 1, jv_string_length_bytes(jv_copy(result)), stdout);
170+
if (options & ASCII_OUTPUT) {
171+
jv_dumpf(result, stdout, JV_PRINT_ASCII);
172+
} else {
173+
fwrite(jv_string_value(result), 1, jv_string_length_bytes(jv_copy(result)), stdout);
174+
}
171175
ret = 0;
172176
jv_free(result);
173177
} else {

0 commit comments

Comments
 (0)