How can we detect the declared encoding before parsing the file? I'd be happy to write a test for this if I knew how.