[xml] convert funny chars to char entites?

Martin v. Loewis martin at v.loewis.de
Mon Sep 16 07:39:12 CEST 2002


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

Regards,
Martin




More information about the Python-list mailing list