unless entity.content_length > 0 if content_encoding = entity.content_encoding entity = case content_encoding.value when "gzip", "x-gzip" then GzipDecompressingEntity.new(entity) when "deflate" then DeflateDecompressingEntity.new(entity) else entity end end EntityUtils.to_string(entity, "UTF-8") end end