Determine file type and encoding using "magic" numbers