Degree symbol (UTF-8 > ASCII)

Dennis Reinhardt DennisR at dair.com
Wed Apr 16 15:10:43 EDT 2003


> I'm working with a xml document which doesn't include an encoding,

The lack of an encoding is your problem.  Pick an encoding which defines 256
characters, not 128, if you want to represent chr(176).in a single byte.

> 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.

UTF-8 has no chr(128) limit.  Your document is UTF-8 encoded (because you
have not specified an encoding) and you need to meet UTF-8 encoding until
you explicitly specify some other encoding.  More likely is that chr(176)
and perhaps what follows are not legal UTF-8.
--

Dennis Reinhardt

DennisR at dair.com   http://www.spamai.com






More information about the Python-list mailing list