httputil: fixes encoding issues with 1.9+

(incompatible with 1.8)