added encoding support to file reference