Eurosymbol in xml document
Diez B. Roggisch
deets at nospam.web.de
Tue Mar 4 07:12:31 EST 2008
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?
>
> leo at brunello usexml $ locale
> LANG=de_DE at euro
> LC_CTYPE="de_DE at euro"
> LC_NUMERIC="de_DE at euro"
> LC_TIME="de_DE at euro"
> LC_COLLATE="de_DE at euro"
> LC_MONETARY="de_DE at euro"
> LC_MESSAGES="de_DE at euro"
> LC_PAPER="de_DE at euro"
> LC_NAME="de_DE at euro"
> LC_ADDRESS="de_DE at euro"
> LC_TELEPHONE="de_DE at euro"
> LC_MEASUREMENT="de_DE at euro"
> LC_IDENTIFICATION="de_DE at euro"
> LC_ALL=de_DE at euro
This is irrelevant.
Diez
More information about the Python-list
mailing list