Degree symbol (UTF-8 > ASCII)

Peter Clark pc451 at yahoo.com
Wed Apr 16 19:30:09 CEST 2003


I'm working with a xml document which doesn't include an encoding, so
it defaults to UTF-8. Of course, all of the text is ASCII, and likely
to remain so. I would like to insert the degree symbol (chr(176)), but
because this is outside the bounds (chr(128) is the limit), Python
raises an XML error. What's the simplest way of getting including an
unadorned degree symbol? Again, it's not necessary to preserve the
UTF-8 encoding, but I'm not quite certain as to how to tell Python
that the XML document is plain ASCII (or I guess in the case of the
degree symbol, latin-1).
    Thanks,
    :Peter




More information about the Python-list mailing list