* In a rare eureka-moment, discovered that my XML string escape function was only...
[citadel.git] / citadel / modules / xmpp / serv_xmpp.c
index d9271e46469235b1fdc731e47bd6186e7f7a6d4b..31656c18b7c3b9f7a1ae91733c89f34ca370a3a9 100644 (file)
@@ -95,11 +95,16 @@ char *xmlesc(char *buf, char *str, int bufsiz)
                        strcpy(&buf[len], "&");
                        len += 5;
                }
-               else if (ch <= 0x7F) {
+               else if ((ch >= 0x20) && (ch <= 0x7F)) {
                        buf[len++] = ch;
                        buf[len] = 0;
                }
-               else if (ch > 0x7F) {
+               else if (ch < 0x20) {
+                       /* we probably shouldn't be doing this */
+                       buf[len++] = '_';
+                       buf[len] = 0;
+               }
+               else {
                        char oct[10];
                        sprintf(oct, "&#%o;", ch);
                        strcpy(&buf[len], oct);