Browse Source

Don't escape backspace or form feed for ntriples.

git-svn-id: http://svn.drobilla.net/serd/trunk@440 490d8e77-9747-427b-9fa3-0b8f29cee8a0
zrythm_meson
David Robillard 10 years ago
parent
commit
2d6b2c5560
  1. 8
      src/writer.c
  2. 6
      tests/good/test-backspace.nt

8
src/writer.c

@ -305,11 +305,15 @@ write_text(SerdWriter* writer, TextContext ctx, @@ -305,11 +305,15 @@ write_text(SerdWriter* writer, TextContext ctx,
case '\n': len += sink("\\n", 2, writer); continue;
case '\r': len += sink("\\r", 2, writer); continue;
case '\t': len += sink("\\t", 2, writer); continue;
case '\b': len += sink("\\b", 2, writer); continue;
case '\f': len += sink("\\f", 2, writer); continue;
case '"': len += sink("\\\"", 2, writer); continue;
default: break;
}
if (writer->syntax != SERD_NTRIPLES) {
switch (in) {
case '\b': len += sink("\\b", 2, writer); continue;
case '\f': len += sink("\\f", 2, writer); continue;
}
}
}
size_t size = 0;

6
tests/good/test-backspace.nt

@ -1,3 +1,3 @@ @@ -1,3 +1,3 @@
<http://example.org/thing> <http://example.org/label> "\b" .
<http://example.org/thing> <http://example.org/label> "\b" .
<http://example.org/thing> <http://example.org/label> "\n\b\n" .
<http://example.org/thing> <http://example.org/label> "\u0008" .
<http://example.org/thing> <http://example.org/label> "\u0008" .
<http://example.org/thing> <http://example.org/label> "\n\u0008\n" .

Loading…
Cancel
Save