Forget about that--I then found /usr/lib/python2.5/encodings/aliases.py, which is also in Python 2.4. Sorry for the silly question!
On Tue, Jul 17, 2007 at 07:04:59PM -0400, Omari Norman wrote: > My program creates new XML files (not through the DOM, but just by > simple file.write calls.) It would be nice if said files would > be in the default system encoding. So in Python 2.5 I use > > ENCODING = codecs.lookup(locale.getdefaultlocale()[1]).name > > locale.getdefaultlocale()[1] sometimes returns a non-canonical encoding > name, such as 'UTF8'. This gives the xml.sax parser a fit, so I use > codecs.lookup to convert the alias to the canonical encoding name. I > then write this encoding in the top line of the XML file. > > Python 2.4's codecs.lookup works differently--it does not return names. > Is there any way to accomplish this in Python 2.4? I went looking > through the codecs module in 2.5 to see if I could find a dict with the > aliases, to no avail. I suppose the worst-case scenario is that I make a > dict myself with common encodings in it (or, just tell people to use > Python 2.5.) > > Thanks, > Omari > > -- > Batteries not included; you put it together. -- Professional driver. Closed course. Do not attempt. -- http://mail.python.org/mailman/listinfo/python-list