I am using a third-party package named jschardet(https://github.com/aadsm/jschardet) to detect the encoding of the file.
Here is my code:
function File