diff options
Diffstat (limited to 'src/writer.c')
-rw-r--r-- | src/writer.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/writer.c b/src/writer.c index be199af4..482721f9 100644 --- a/src/writer.c +++ b/src/writer.c @@ -369,7 +369,7 @@ write_uri(SerdWriter* writer, const char* utf8, size_t n_bytes, SerdStatus* st) if (size == 0) { // Corrupt input, write percent-encoded bytes and scan to next start char escape[4] = {0, 0, 0, 0}; - for (; i < n_bytes && (utf8[i] & 0x80); ++i) { + for (; i < n_bytes && !is_utf8_leading((uint8_t)utf8[i]); ++i) { snprintf(escape, sizeof(escape), "%%%02X", (uint8_t)utf8[i]); len += sink(escape, 3, writer); } @@ -590,7 +590,7 @@ write_text(SerdWriter* writer, if (size == 0) { // Corrupt input, write replacement character and scan to the next start st = esink(replacement_char, sizeof(replacement_char), writer); - for (; i < n_bytes && (utf8[i] & 0x80); ++i) { + for (; i < n_bytes && !is_utf8_leading((uint8_t)utf8[i]); ++i) { } } else { i += size - 1U; |