[Python-Dev] Getting a list of registered codecs

M.-A. Lemburg mal at egenix.com
Tue Apr 30 12:18:27 CEST 2013

On 30.04.2013 11:52, Paul Moore wrote:
> On 30 April 2013 10:42, M.-A. Lemburg <mal at egenix.com> wrote:
>> It would be possible to get a list of registered codec search functions,
>> but there's no API to ask the search functions for a list of supported
>> codecs.
> OK, so there's no way to determine in advance what values of enc will work
> in bytestr.decode(enc) or str.encode(enc)?
> Is there a reason why not? 

Nothing in particular, except maybe that it can be expensive to generate
such a list (e.g. you'd have to verify that the codec modules import
correctly and provide the needed getregentry() API).

> As I say, a tool that offers to re-encode a file
> could reasonably be expected to list the encodings it supported (if only to
> help the user work out which way to spell utf-16le or utf16le or utf16-le
> or utf-16-le or... :-))
> I've raised http://bugs.python.org/issue17878 for this. Further discussion
> may be more appropriate there than on python-dev.

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Apr 30 2013)
>>> Python Projects, Consulting and Support ...   http://www.egenix.com/
>>> mxODBC.Zope/Plone.Database.Adapter ...       http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
2013-04-30: Released eGenix PyRun 1.2.0 ...       http://egenix.com/go44
2013-04-17: Released eGenix mx Base 3.2.6 ...     http://egenix.com/go43

::::: Try our mxODBC.Connect Python Database Interface for free ! ::::::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611

More information about the Python-Dev mailing list