X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=save-xml.c;h=a1553193d63965212a13f16def8be0f323b0a011;hb=d9106995d39138dbce5f3306a391361f68ce0a07;hp=cd7bad2bad547e652529a301ab8dba9dee3f55cd;hpb=22fcef2ec7fd1efd3d1df2aba2b7b3af5d463288;p=ext%2Fsubsurface.git
diff --git a/save-xml.c b/save-xml.c
index cd7bad2..a155319 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 = "<";
break;
@@ -102,7 +111,7 @@ static void save_overview(FILE *f, struct dive *dive)
show_depth(f, dive->maxdepth, " ", "\n");
show_depth(f, dive->meandepth, " ", "\n");
show_temperature(f, dive->airtemp, " ", "\n");
- show_temperature(f, dive->watertemp, " ", "\n");
+ show_temperature(f, dive->watertemp, " ", "\n");
show_duration(f, dive->duration, " ", "\n");
show_duration(f, dive->surfacetime, " ", "\n");
show_pressure(f, dive->beginning_pressure, " ", "\n");