xmlrpclib and binary data as normal parameter strings

Rune Froysa rune.froysa at usit.uio.no
Tue Apr 19 08:33:20 EDT 2005


Trying something like::
  import xmlrpclib
  svr = xmlrpclib.Server("http://127.0.0.1:8000")
  svr.test("\x1btest")

Failes on the server with::
  xml.parsers.expat.ExpatError: not well-formed (invalid token)

(Smaller test-case: xmlrpclib.loads(xmlrpclib.dumps(('\x1btest',))))

Shouldn't this be allowed? 

>From http://www.xmlrpc.com/spec ::
  Any characters are allowed in a string except < and &, which are
  encoded as < and &. A string can be used to encode binary
  data.

>From http://www.w3.org/TR/2004/REC-xml11-20040204/#dt-character ::
  Consequently, XML processors MUST accept any character in the range
  specified for Char
  ...
  Char  ::=  [#x1-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]

(I'm aware that xmlrpclib.Binary can be used as an ugly work-around.)

-- 
Rune Frøysa



More information about the Python-list mailing list