summaryrefslogtreecommitdiffstats
path: root/save-xml.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-09-01 20:28:17 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-09-01 20:28:17 -0700
commitbafc7e771ed3f7cfa2589772a7ab66821c0bab75 (patch)
tree8ae8626d7aba42c421a63c15b3064ee13be104bf /save-xml.c
parent22fcef2ec7fd1efd3d1df2aba2b7b3af5d463288 (diff)
downloadsubsurface-bafc7e771ed3f7cfa2589772a7ab66821c0bab75.tar.gz
We can't save escape characters.
I think it should be legal xml, but whatever. libxml2 is very unhappy, and complains when loading - even if I escape them. So let's just replace the low escape characters with '?'. The only thing to ever care was my test-case, I suspect. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'save-xml.c')
-rw-r--r--save-xml.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/save-xml.c b/save-xml.c
index cd7bad2ba..b91e24e8d 100644
--- a/save-xml.c
+++ b/save-xml.c
@@ -44,6 +44,10 @@ static void show_pressure(FILE *f, pressure_t pressure, const char *pre, const c
* We're outputting utf8 in xml.
* We need to quote the characters <, >, &.
*
+ * Technically I don't think we'd necessarily need to quote the control
+ * characters, but at least libxml2 doesn't like them. It doesn't even
+ * allow them quoted. So we just skip them and replace them with '?'.
+ *
* Nothing else (and if we ever do this using attributes, we'd need to
* quote the quotes we use too).
*/
@@ -60,6 +64,11 @@ static void quote(FILE *f, const char *text)
case 0:
escape = NULL;
break;
+ case 1 ... 8:
+ case 11: case 12:
+ case 14 ... 31:
+ escape = "?";
+ break;
case '<':
escape = "&lt;";
break;