Add zip content-type test
Move charset detection into own function
Move input stream creation into separate function