aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS8
-rw-r--r--src/writer.c2
2 files changed, 6 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index 253d8645..cbae6338 100644
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,10 @@
serd (9999) unstable;
- * Add incremental read interface suitable for reading from infinite streams.
- * Add -e option to serdi to use incremental reading.
- * Reset indent when finishing a write.
+ * Add incremental read interface suitable for reading from infinite streams
+ * Add -e option to serdi to use incremental reading
+ * Reset indent when finishing a write
+ * Report write size correctly when invalid UTF-8 is encountered and a
+ replacement character is written
-- David Robillard <d@drobilla.net>
diff --git a/src/writer.c b/src/writer.c
index b03e5afd..02c362af 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -210,7 +210,7 @@ write_text(SerdWriter* writer, TextContext ctx,
fprintf(stderr, "Invalid UTF-8: %X\n", in);
const uint8_t replacement_char[] = { 0xEF, 0xBF, 0xBD };
len += sink(replacement_char, sizeof(replacement_char), writer);
- return 0;
+ return len;
}
if (ctx != WRITE_URI && !(writer->style & SERD_STYLE_ASCII)) {