work around Net::HTTP change breaking a test by adding a default accept-encoding header
fix some encoding code