This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: xml-rpc Server object does not propagate the encoding to Unmarshaller
Type: enhancement Stage: resolved
Components: Tests, XML Versions: Python 3.6, Python 3.5, Python 2.7
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: Timothée.CEZARD, eric.araujo, loewis, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2010-06-16 09:20 by Timothée.CEZARD, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
xmlrpc_bug.tar.gz Timothée.CEZARD, 2010-06-16 09:20 tar ball containing two scripts reproducing the issue
xmlrpclib_fixed.py Timothée.CEZARD, 2010-06-16 14:44 a fixed version of the xmlrpclib module
test_xmlrpc_encoding-2.7.patch serhiy.storchaka, 2016-01-16 17:51 review
test_xmlrpc_encoding-3.5.patch serhiy.storchaka, 2016-01-16 17:51 review
Messages (6)
msg107910 - (view) Author: Timothée CEZARD (Timothée.CEZARD) Date: 2010-06-16 09:20
xmlrpc cleint  (Server class) default encoding is utf-8 it can be modified through the encoding keyword parameter. This parameter is not passed to the Unmarshaller that decode the bit flow causing the server to crash
attached is two script reproducing the issue
msg107918 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-06-16 12:20
Thank your for reporting this bug. Are you able to reproduce the bug with current development versions, a.k.a. 2.7 (svn trunk, or the rc release) and 3.2 (py3k branch)? Only security and documentation fixes go in stable releases like 2.6 and 3.1. Also, please upload separate files instead of archives, it’s easier for review. Thanks again!
msg107924 - (view) Author: Timothée CEZARD (Timothée.CEZARD) Date: 2010-06-16 14:44
With 2.7 I'm getting another exception 
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 5, column 15
where with 2.6 I was getting 
UnicodeDecodeError: 'utf8' codec can't decode byte 0xa3 in position 0: unexpected code byte
I didn't try with 3.2 yet.

I also "fixed" the bug in 2.6 by passing the encoding stored in ServerProxy to Transport and then Unmarshaller.
I probably did not do it the proper way but it works now
msg120998 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-11-12 00:41
Could you reupload your fix as a diff instead of a whole file?  See http://www.python.org/dev/patches/ for some help.
msg258397 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-01-16 17:51
xmlrpc uses XML. This format includes information about the encoding and doesn't need external specification.

The server in the example is not correct. It generates XML with default XML declaration that implies the UTF-8 encoding, but the body is encoded with non-UTF-8 encoding. If add the argument encoding='UTF-8' the example works.

But this feature is not covered by tests. Proposed patch adds tests for non-default client and server encodings. No changes for the xmlrpc module itself is needed.
msg258535 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-01-18 17:40
New changeset 04e95f05aafe by Serhiy Storchaka in branch '2.7':
Issue #9006: Added tests for XML RPC with non-UTF-8 encoding.
https://hg.python.org/cpython/rev/04e95f05aafe

New changeset 59cb8811286a by Serhiy Storchaka in branch '3.5':
Issue #9006: Added tests for XML RPC with non-UTF-8 encoding.
https://hg.python.org/cpython/rev/59cb8811286a

New changeset 96a7603d25ea by Serhiy Storchaka in branch 'default':
Issue #9006: Added tests for XML RPC with non-UTF-8 encoding.
https://hg.python.org/cpython/rev/96a7603d25ea
History
Date User Action Args
2022-04-11 14:57:02adminsetgithub: 53252
2016-01-18 17:43:09serhiy.storchakasetstatus: open -> closed
resolution: rejected
stage: patch review -> resolved
2016-01-18 17:40:50python-devsetnosy: + python-dev
messages: + msg258535
2016-01-16 17:51:24serhiy.storchakasetfiles: + test_xmlrpc_encoding-3.5.patch
2016-01-16 17:51:07serhiy.storchakasetfiles: + test_xmlrpc_encoding-2.7.patch


assignee: serhiy.storchaka
keywords: + patch
stage: patch review
versions: + Python 3.5, Python 3.6, - Python 3.1, Python 3.2
nosy: + serhiy.storchaka
messages: + msg258397
components: + Tests
type: behavior -> enhancement
2010-11-12 00:41:47eric.araujosetversions: + Python 3.1, Python 2.7, Python 3.2, - Python 2.6
nosy: + loewis

messages: + msg120998

type: crash -> behavior
2010-06-16 14:44:55Timothée.CEZARDsetfiles: + xmlrpclib_fixed.py

messages: + msg107924
2010-06-16 12:20:54eric.araujosetnosy: + eric.araujo
messages: + msg107918
2010-06-16 09:20:34Timothée.CEZARDcreate