[xml] convert funny chars to char entites?
thoa0025 at mail.usyd.edu.au
Mon Sep 16 10:36:23 CEST 2002
now when i do filehandle.write(str)
on text that has the funny chars in it. it crashes with an error like this
Traceback (most recent call last):
File "./batch-maid.py", line 85, in ?
File "./batch-maid.py", line 70, in generate_browse_options
UnicodeError: ASCII encoding error: ordinal not in range(128)
whats going on?
how can i fix it?
"Martin v. Loewis" <martin at v.loewis.de> wrote in message
news:m3elbuze67.fsf at mira.informatik.hu-berlin.de...
> ":B nerdy" <thoa0025 at mail.usyd.edu.au> writes:
> > ive got a string "Il Est Né" and i want to put it into a xml document
> > is there a quick and easy way to conver the funny characters to char
> > entities so i can store them?
> I recommend you properly declare the encoding of the document, e.g.
> <?xml version="1.0" encoding="iso-8859-1"?>
> (assuming the é is meant to be encoded in Latin-1).
> XML does not define external entities for non-ASCII characters, so you
> would have to create a DTD first if you want them.
More information about the Python-list