aboutsummaryrefslogtreecommitdiffstats
path: root/src/writer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/writer.c')
-rw-r--r--src/writer.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/writer.c b/src/writer.c
index d8fe039f..cee0455f 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -100,7 +100,7 @@ write_text(SerdWriter* writer, TextContext ctx,
// Fast bulk write for long strings of printable ASCII
size_t j = i;
for (; j < n_bytes; ++j) {
- if (utf8[j] == terminator || utf8[j] == '\\'
+ if (utf8[j] == terminator || utf8[j] == '\\' || utf8[j] == '"'
|| (((writer->style & SERD_STYLE_ASCII) || ctx == WRITE_URI)
&& !in_range(utf8[j], 0x20, 0x7E))) {
break;
@@ -117,6 +117,8 @@ write_text(SerdWriter* writer, TextContext ctx,
if (ctx == WRITE_LONG_STRING) {
if (in == '\\') {
sink("\\\\", 2, writer); continue;
+ } else if (in == '\"' && i == n_bytes) {
+ sink("\\\"", 2, writer); continue; // '"' at end of string
}
} else {
switch (in) {