Changes by Serhiy Storchaka :
--
resolution: -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder: -> xmlrpc library returns string which contain null ( \x00 )
___
Python tracker
Éric Araujo mer...@netwok.org added the comment:
My bad, I read too fast.
Peter: Can you rework your patch to address Martin’s review?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10066
Peter Gyorko gyor...@balabit.hu added the comment:
The shortest code which can trigger this error is the following:
import xmlrpclib
print xmlrpclib.dumps(('\x01',))
params
param
valuestring/string/value
/param
/params
As you can see, the escape method does not care about non-printable
Martin v. Löwis mar...@v.loewis.de added the comment:
No, CDATA is not an appropriate mechanism to encapsulate bytes in XML. The data
in the CDATA section must still match the Char production, and it must still
follow the encoding.
--
___
Python
Éric Araujo mer...@netwok.org added the comment:
Thanks for the new patch. I suggest one style change before committing:
if re.search(snip, s) is not None:
Agree that CDATA is not appropriate.
Martin: I’m reopening the bug in reaction to your message “I could accept a
patch that rejects
Martin v. Löwis mar...@v.loewis.de added the comment:
Éric, I think the patch needs some rework. First, it is incorrect/incomplete:
please see the Char definition for a complete list of characters that must be
excluded. This then raises a Unicode vs. bytes issue, where invalid Unicode
Éric Araujo mer...@netwok.org added the comment:
Thanks for the report. Unfortunately, 2.6 only gets security fixes, not
general bug fixes; can you tell if this applies to 2.7, 3.1 and 3.2? If you
have a small script that displays the problem, please attach it.
--
nosy:
Martin v. Löwis mar...@v.loewis.de added the comment:
The patch is incorrect. Even though this may let get these characters
through, the other end will have no clue that \x is meant as an escape.
Please face the ugly truth: XML (and hence XML-RPC) just does not support these
characters, see
New submission from Peter Gyorko gyor...@balabit.hu:
If I add a string to the response, which contains non-printable characters, the
output will not be parsed by the most of the XML parsers (I tried with XML-RPC
for PHP).
Here is my quick and dirty fix:
--- a/Lib/xmlrpclib.py
+++