ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xml-sig
xml-sig
[XML-SIG] Re: [bug] Encoding troubles with attributes' CDATA, py1.5.2 + pyxml 0.6.6
by Alexandre Fayolle other posts by this author
Aug 30 2001 4:26PM messages near this date
[XML-SIG] [bug] Encoding troubles with attributes' CDATA, py1.5.2 + pyxml 0.6.6 | [XML-SIG] [ pyxml-Bugs-456925 ] Encoding troubles with attributes' CDATA
On Thu, 30 Aug 2001, Nicolas Chauvat wrote:
>  Hi List,
>  
>  With python 1.5.2 and PyXml 0.6.6, I get problems when executing the
>  following piece of code :
>  
>  >>> s = '<?xml version="1.0" encoding="ISO-8859-1"?><d nom="Détails de la
>  specialité" />'
>  >>> d = Sax2.FromXml(s)
>  >>> PrettyPrint(d,encoding='iso-8859-1')
<snip> 


Well actually this code will break with python 2.1 and pyxml 0.6.6 too.

The problem is that the Printer class will convert the data from utf-8 to
latin-1 twice for attributes : if you give a look at the visitAttr method,
it first calls TranslateCdata (which does the first conversion), and then
_write which attempts to convert the code again, resulting in the
exception being raised.


Alexandre Fayolle
-- 
LOGILAB, Paris (France).
http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org
Narval, the first software agent available as free software (GPL).


_______________________________________________
XML-SIG maillist  -  XML-SIG@[...].org
http://mail.python.org/mailman/listinfo/xml-sig
Thread:
Nicolas Chauvat
Alexandre Fayolle

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved