I am trying to use Google graph API (image) to show some data in the form of PIE chart. http://chart.apis.google.com/chart?chs=250×150&cht=p3&chd=t:41.86,26.00,21.78,10.36&chdl=User998|User591|User671|Others, this link gives a pie chart when viewed in browser. But, when I am trying to get the response using HttpClient, I am getting illegal character error. I am using following code to get the response
HttpClient client = new DefaultHttpClient();
HttpResponse httpResponse;
try {
String chartUrl = "above url";
//Here, I am getting illegal character error.
HttpGet getRequest = new HttpGet(chartUrl);
getRequest.setHeader("Content-Type", "image/png");
httpResponse = client.execute(getRequest);
HttpEntity entity = httpResponse.getEntity();
if (entity != null) {
InputStream instream = entity.getContent();
bmImg = BitmapFactory.decodeStream(instream);
instream.close();
}
}
catch(Exception e)
{
//TODO
}
Can anyone tell me how to fix this issue?
Thanks,
Ashwani
The character in question is |, you can work around by using %7C instead in the URL and it should work.