[EuroPython] Exporting the registration data

M.-A. Lemburg mal@lemburg.com
Tue, 28 May 2002 17:33:54 +0200


Joachim Schmitz wrote:
> This is a bug in  xmlrpclib.py
> 
> change _decode around line 105 of xmlrpclib.py like so:
> 
> def _decode(data, encoding, is8bit=re.compile("[\x80-\xff]").search):
>    # decode non-ascii string (if possible)
>    if unicode and is8bit(data):
>        try:
>            data = unicode(data, encoding)
>        except:
>            pass
>            #data = "error decoding"
>    return data
> 

This would just be a gross hack :-)

The bug is on the server side:
XML and xmlrpclib use UTF-8 as default encoding if no
other encoding is specified, so any latin-1 character
data (which is used in e.g. the name data) will trigger
this error on the client side, since it checks the XML
coming from the server for the XML encoding attribute.
If this is not available, it uses UTF-8.

Anyway, I can understand that you can't change the server
side code for this, so I'll just hack my way into xmlrpclib
from the script :-)

>> This looks like a server side problem to me. Esp. the not
>> well-formed errors are disturbing. The server side should use
>> Latin-1 as default encoding rather than UTF-8.

Thanks for all the work you put into this !

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                   http://www.egenix.com/files/python/
Meet us at EuroPython 2002:                 http://www.europython.org/