Add the condition of whether all characters are in the XML-CHAR
authorTaylor R. Campbell <net/mumble/campbell>
Fri, 28 Jul 2006 16:23:08 +0000 (16:23 +0000)
committerTaylor R. Campbell <net/mumble/campbell>
Fri, 28 Jul 2006 16:23:08 +0000 (16:23 +0000)
alphabet to ENCODE-STRING's decision of whether to return raw
strings or base64-encoded data.

v7/src/xml/xml-rpc.scm

index cdd2a9d4ed6d9de3755a872e1b12b9c32d19a681..8c8538b1cdcdd11355d1cbb597b217b40d979f41 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: xml-rpc.scm,v 1.5 2006/07/25 18:21:44 riastradh Exp $
+$Id: xml-rpc.scm,v 1.6 2006/07/28 16:23:08 riastradh Exp $
 
 Copyright 2003,2004,2005,2006 Massachusetts Institute of Technology
 
@@ -293,7 +293,12 @@ USA.
                                       'encode-value))))))
 
 (define (encode-string string)
-  (if (utf8-string-valid? string)
+  (if (and (utf8-string-valid? string)
+           (for-all-chars-in-string? (alphabet-predicate alphabet:xml-char)
+                                     string
+                                     0
+                                     (string-length string)
+                                     'UTF-8))
       string
       (rpc-elt:base64
        (call-with-output-string