aboutsummaryrefslogtreecommitdiffstats
path: root/src/writer.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-12-26 21:13:07 +0000
committerDavid Robillard <d@drobilla.net>2011-12-26 21:13:07 +0000
commitf4b25c02971b82cd841d3f6f7afd020b97825226 (patch)
tree4accd4f41b8f1f53b5ae0aae193a6b155c366331 /src/writer.c
parentf3c95977f6c71b936e98f41c321265835c4fd623 (diff)
downloadserd-f4b25c02971b82cd841d3f6f7afd020b97825226.tar.gz
serd-f4b25c02971b82cd841d3f6f7afd020b97825226.tar.bz2
serd-f4b25c02971b82cd841d3f6f7afd020b97825226.zip
Escape non-printable ASCII characters in ASCII output (fix #795).
git-svn-id: http://svn.drobilla.net/serd/trunk@278 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src/writer.c')
-rw-r--r--src/writer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/writer.c b/src/writer.c
index a9209f80..735dcaaf 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -145,7 +145,8 @@ write_text(SerdWriter* writer, TextContext ctx,
if ((in & 0x80) == 0) { // Starts with `0'
size = 1;
c = in & 0x7F;
- if (in_range(c, 0x20, 0x7E) || (ctx != WRITE_URI && is_space(c))) {
+ if (in_range(c, 0x20, 0x7E)
+ || (is_space(c) && ctx == WRITE_LONG_STRING)) {
sink(&in, 1, writer); // Print ASCII character
} else {
snprintf(escape, 7, "\\u%04X", c);