Posting a url containing an underscore (_)
<p>I am posting a url with params containg an underscore (_).</p>

<p>sample: <code>http://sdsdsds_asasasahjhd.com/dsdsdsd/login.json?</code></p>

<p>I am posting it like this:</p>

<pre><code>    HttpClient httpclient = new DefaultHttpClient();
    HttpPost httppost = new HttpPost("http://sdsdsds_asasasahjhd.com/dsdsdsd/login.json?");
    try {
        List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(2);
        nameValuePairs.add(new BasicNameValuePair("key1", "value1"));
        nameValuePairs.add(new BasicNameValuePair("key2", "value2"));
        nameValuePairs
                .add(new BasicNameValuePair("key3", "value3"));
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

        // Execute HTTP Post Request
        HttpResponse response = httpclient.execute(httppost);

    } catch (Exception e) {
        e.printStackTrace();
    }
</code></pre>

<p>When I am inspecting <code>httpclient.execute(httppost)</code> I am getting <code>IllegalArgumentException</code> and in catch in exception details it is telling <code>Host name cannot be null</code>.
Please specify any solution.</p>

<p>I have gone through some other questions here:</p>

<ul>
<li><a href="http://stackoverflow.com/questions/13007329/java-lang-illegalstateexception-target-host-must-not-be-null-or-set-in-paramet">java.lang.IllegalStateException: Target host must not be null, or set in parameters</a></li>
<li><a href="http://stackoverflow.com/questions/12537522/host-name-may-not-be-null-in-httpresponse-execute-for-android">Host name may not be null in HttpResponse execute for android</a></li>
</ul>

<p>but no use as I am not encoding the whole url.</p>
