Encode input to httplib to avoid Unicode coercion in Python 2