Valid encodings for a Python source file

Ben Finney ben+python at benfinney.id.au
Thu Jun 7 23:00:24 EDT 2018


Daniel Glus <danielhglus at gmail.com> writes:

> I'm trying to figure out the entire list of possible encodings for a Python
> source file - that is, encodings that can go in a PEP 263
> <https://www.python.org/dev/peps/pep-0263/> encoding specification, like #
> -*- encoding: foo -*-.

What if the answer is not an emunerated set of encodings? That is, I am
pretty sure the set isn't specified, to allow the encoding to be
negotiated. Whatever the interpreter recognises as an encoding can be
the encoding of the source.

So, I guess that leads to the question: Why do you need it to be an
exhaustive set (rather than deliberately unspecified)? What are you
hoping to do with that information?

-- 
 \       “Good design adds value faster than it adds cost.” —Thomas C. |
  `\                                                              Gale |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list