[XML-SIG] XML Unicode and UTF-8

Uche Ogbuji uche.ogbuji at fourthought.com
Tue Aug 10 03:02:25 CEST 2004

On Thu, 2004-08-05 at 05:03, n.youngman at ntlworld.com wrote:
> > 
> > From: "Martin v. Löwis" <martin at v.loewis.de>
> > Date: 2004/08/05 Thu AM 10:41:59 GMT
> > To: n.youngman at ntlworld.com
> > CC: xml-sig at python.org
> > Subject: Re: [XML-SIG] XML Unicode and UTF-8
> <SNIP>
> > State all the information that you have, preferably in the form:
> > 1. this is what I did
> > 2. this is what happened
> > 3. this is what I expected to happen instead.
> Well, I was trying to state the problem and not impose my own preconceptions of how it should be done, but if you want to go straight into debugging that's fine with me.

The information in your first message was essentially useless for anyone
trying to understand your problem.  I couldn't make heads or tails of it
either.  Martin told you exactly what data we need in order to help
you.  Please take note and heed his advice when you post for help here
(and probably any other forum).

> First Pass:
>                 segment_tag.appendChild( charset_tag )
>                 unicode_tag = doc.createElement( 'unicode' )

You should use Unicode objects in DOM update operations (u'unicode').

>                 unicode_tag.appendChild( doc.createTextNode( segment[0] ) )
>                 segment_tag.appendChild( unicode_tag )
> Inserts binary data into the segment/unicode tag

Binary data?!?

> Saving with 
>     XMLFILE = open( filename, "w" )
>     xml.documentElement.writexml( XMLFILE, indent="", addindent="", newl="")
>     XMLFILE.close()
> Leaves binary data in the document. I have assumed that this was raw Unicode, may be that's a flawed assumption? 

You still haven't provided enough information.  What is this "binary
data"?  what exactly are the values of the variables in the above code

Uche Ogbuji                                    Fourthought, Inc.
http://uche.ogbuji.net    http://4Suite.org    http://fourthought.com
Decomposition, Process, Recomposition - http://www.xml.com/pub/a/2004/07/28/py-xml.html
Perspective on XML: Steady steps spell success with Google - http://www.adtmag.com/article.asp?id=9663
Managing XML libraries - http://www.adtmag.com/article.asp?id=9160
Commentary on "Objects. Encapsulation. XML?" - http://www.adtmag.com/article.asp?id=9090
Harold's Effective XML - http://www.ibm.com/developerworks/xml/library/x-think25.html
A survey of XML standards - http://www-106.ibm.com/developerworks/xml/library/x-stand4/

More information about the XML-SIG mailing list