[XML-SIG] xmlrpc char '/213/' becomes '<'

MMillikan@MARKM300 MMillikan@MARKM300
07 Jun 2001 18:22:52 -0400


A pdf file (string) sent from zope 2.3.0 in response to an xmlrpc call
from a python script inside an asp page (using IIS 4.0) works
perfectly, except: a few bytecodes get converted along the way.

The start of the source pdf file is:

%PDF-1.3
%“Œ‹ž
% 'BasicFonts' '<reportlab.pdfbase.pdfdoc.PDFDictionary instance a' 
1 0 obj

[etc.]

the received file begins:

%PDF-1.3
%“Œ<ž
% 'BasicFonts' '<reportlab.pdfbase.pdfdoc.PDFDictionary instance a' 
1 0 obj

[etc.]

Note the third byte of the second line: a '/213/' was converted to
'/074' ('<'). This appears to happen consistently throughout the
file. Elsewhere '/0233' is converted to '/076' ('>'). There may be a
view other byte codes which are converted -- I didn't check
exhaustively. However, the other three '8 bit' byte codes on the
second line made the transition unscathed.

The libraries used were 'xmlrpclib.py version 0.9.9' and 'sgmlop.pyd'
on both the zope server and the IIS server -- each running python
1.5.2.

I notice that xmlrpclib uses cgi.escape() in its processing of string
parameters. This seems to correlate with the resulting '<' and '>'
characters in the received file. But why would characters '/213'
((guilsinglleft) and '/233' (guilsinglright) be coerced?

The pdf file is using 'WinAnsiEncoding' (windows code page 1252). XML
defaults to utf-8 (yes?), is this the problem?

The xmlrpc call from IIS is made like so:

[...]
import xmlrpclib
server = xmlrpclib.Server('http://rgve1')
f = open('bad.pdf','wb')
f.write(buffer(server.aphototest.photopdf()))
f.flush()
f.close()

On the zope server 'photopdf' is an external method that creates a pdf
file and then just:

[...]
return open('Photoreport.pdf','rb').read()

Any suggestions?