Python and UTF-8

Martin von Loewis loewis at informatik.hu-berlin.de
Thu Jan 3 12:29:05 EST 2002


Giorgi Lekishvili <gleki at gol.ge> writes:

> I wonder if you find time to give me a hint where can I get the
> information on which encoding schemes are currently suported in
> Python...

Currently, there is no programmatic way to find all supported
encodings. In general, take the IANA registry of character sets at

http://www.iana.org/assignments/character-sets

as a starting point, and use the names in that registry (if there is a
preferred MIME name as an alias, use that, otherwise use the Name, not
an Alias).

To get an idea of what is supported, see

<prefix>/lib/python<version>/encodings

For a module foo_bar.py in this directory, you can use alternative
spellings, like "foo-bar", or "foo_BAR" (i.e. all of ISO-8859-1,
iso-8859-1, and ISO_8859-1 refer to the same encoding).

If there is an encoding that is not supported by Python which you
need, please report it as a bug at sf.net/projects/python. Meanwhile,
you may find the additional codecs at sf.net/projects/python-codecs
useful. In particular, on Unix, the iconv codec will give you access
to many additional encodings (depending on your operating system).

HTH,
Martin




More information about the Python-list mailing list