bug fix. Non-ASCII data in strings was reported as control characters

This commit is contained in:
cozis
2022-04-24 23:41:16 +02:00
parent 6e325ce4ea
commit 87c133d962
+4 -4
View File
@@ -557,16 +557,16 @@ static void *parse_string(context_t *ctx, _Bool raw)
return NULL; return NULL;
} }
if(ctx->str[ctx->i] < 32) if((unsigned char) ctx->str[ctx->i] > 127)
{ {
xj_preport(ctx->error, ctx->str, ctx->i, "String contains control characters"); xj_preport(ctx->error, ctx->str, ctx->i, "String contains non-ASCII data");
spc_free(&spc); spc_free(&spc);
return NULL; return NULL;
} }
if((unsigned char) ctx->str[ctx->i] > 127) if((unsigned char) ctx->str[ctx->i] < 32)
{ {
xj_preport(ctx->error, ctx->str, ctx->i, "String contains non-ASCII data"); xj_preport(ctx->error, ctx->str, ctx->i, "String contains control characters");
spc_free(&spc); spc_free(&spc);
return NULL; return NULL;
} }