PEP 263 defines how to declare Python source code encoding.
Normally, the first 2 lines of a Python file should start with:
#!/usr/bin/python # -*- c
PEP 263:
the first or second line must match the regular expression "coding[:=]\s*([-\w.]+)"
So, "encoding: UTF-8" matches.
PEP provides some examples:
#!/usr/bin/python # vim: set fileencoding= :
# This Python file uses the following encoding: utf-8 import os, sys