Hellmut Weber wrote: > Hi, > i'm new here in this list. > > i'm developing a little program using an xml document. So far it's easy > going, but when parsing an xml document which contains the EURO symbol > ('€') then I get an error: > > UnicodeEncodeError: 'charmap' codec can't encode character u'\xa4' in > position 11834: character maps to <undefined> > > the relevant piece of code is: > > from xml.dom.minidom import Document, parse, parseString > ... > doc = parse(inFIleName)
The contents of the file must be encoded with the proper encoding which is given in the XML-header, or has to be utf-8 if no header is given. From the above I think you have a latin1-based document. Does the encoding header match? > > [EMAIL PROTECTED] usexml $ locale > [EMAIL PROTECTED] > LC_CTYPE="[EMAIL PROTECTED]" > LC_NUMERIC="[EMAIL PROTECTED]" > LC_TIME="[EMAIL PROTECTED]" > LC_COLLATE="[EMAIL PROTECTED]" > LC_MONETARY="[EMAIL PROTECTED]" > LC_MESSAGES="[EMAIL PROTECTED]" > LC_PAPER="[EMAIL PROTECTED]" > LC_NAME="[EMAIL PROTECTED]" > LC_ADDRESS="[EMAIL PROTECTED]" > LC_TELEPHONE="[EMAIL PROTECTED]" > LC_MEASUREMENT="[EMAIL PROTECTED]" > LC_IDENTIFICATION="[EMAIL PROTECTED]" > [EMAIL PROTECTED] This is irrelevant. Diez -- http://mail.python.org/mailman/listinfo/python-list