Change string encoding so that base64-encoded strings are properly
authorTaylor R. Campbell <net/mumble/campbell>
Tue, 25 Jul 2006 18:21:44 +0000 (18:21 +0000)
committerTaylor R. Campbell <net/mumble/campbell>
Tue, 25 Jul 2006 18:21:44 +0000 (18:21 +0000)
wrapped in `base64' elements, and so that non-base64-encoded strings
are not wrapped in superfluous `string' elements.

v7/src/xml/xml-rpc.scm

index 729ade41d0ea217045f90a1dacdd649692b0d1d1..cdd2a9d4ed6d9de3755a872e1b12b9c32d19a681 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: xml-rpc.scm,v 1.4 2006/01/30 20:20:45 cph Exp $
+$Id: xml-rpc.scm,v 1.5 2006/07/25 18:21:44 riastradh Exp $
 
 Copyright 2003,2004,2005,2006 Massachusetts Institute of Technology
 
@@ -294,12 +294,13 @@ USA.
 
 (define (encode-string string)
   (if (utf8-string-valid? string)
-      (rpc-elt:string string)
-      (call-with-output-string
-       (lambda (port)
-         (let ((context (encode-base64:initialize port #f)))
-           (encode-base64:update context string 0 (string-length string))
-           (encode-base64:finalize context))))))
+      string
+      (rpc-elt:base64
+       (call-with-output-string
+        (lambda (port)
+          (let ((context (encode-base64:initialize port #f)))
+            (encode-base64:update context string 0 (string-length string))
+            (encode-base64:finalize context)))))))
 
 (define *xml-rpc:encode-value-handler* #f)
 \f