Python recognizes the following as instruction which defines file's encoding:
# -*- coding: utf-8 -*-
I definitely saw this kind of instructions before (-*- var: value -*-
), so I assume Python did not invent them and is not the only one that uses such instructions.
Where does this syntax come from? Is there full specification, e.g. can the value include spaces, special symbols, newlines, even -*-
itself?
What other software recognizes such metadata syntax?
My program will be writing plain text files and I'd like to include some metadata in them using this format.