open file with encoding (python 2/3 supported)