auto detect file encoding