Characters in Python

Just just at xs4all.nl
Sun Jun 8 16:46:46 EDT 2003


In article <mailman.1055097317.28762.python-list at python.org>,
 Jp Calderone <exarkun at intarweb.us> wrote:

> > Is it possible to get at a list of the available encoding names at 
> > runtime?

>   No.  Rather than registering encodings, in the Python system, you register
> predicate functions.  When an encoding is requested, Python calls all the
> registered predicates in turn with the encoding name.  When one returns the
> appropriate values (encoder and decoder objects) rather than None, it uses
> those objects to handle the encoding.

I was afraid it worked like that... My use case is this: if a user opens 
a text file in my app that isn't ascii, I'd like to offer a dialog so 
the user can choose an encoding from a popup menu or a combo box. I 
guess I'll just hard code a list of encodings.

Just




More information about the Python-list mailing list