Added a function to get a better behaviour regarding file encodings