Python

Getting the encoding of a file

with open('filename') as origin:
   return origin.encoding