Added file encoding support with options and autodetection