Resolve file encoding