Determine encoding of source files used for coverage (#1691)

Restore behavior that used to come from `package:http`,
check the headers to choose an encoding.
4 files changed