java - org.apache.http.client.fluent corrupts URL -
i have such url https://maps.googleapis.com/maps/api/distancematrix/json?units=metric&origins=belarus,minsk,kuprevicha,1/2&destinations=belarus,minsk,kurchatova,8&key={api_key} , in brovser counts distance correctly:
{ "destination_addresses" : [ "ул. Курчатова 8, Минск, Беларусь" ], "origin_addresses" : [ "ул. Академика Купревича 1/2, Минск 220141, Беларусь" ], "rows" : [ { "elements" : [ { "distance" : { "text" : "24,5 км", "value" : 24526 }, "duration" : { "text" : "20 мин.", "value" : 1196 }, "status" : "ok" } ] } ], "status" : "ok" }
but when use org.apache.http.client.fluent.request:
string req = request.get(uri).execute().handleresponse(utf8_content_handler);
after executing code have such result:
{ "destination_addresses" : [ "minsk, belarus" ], "origin_addresses" : [ "minsk, belarus" ], "rows" : [ { "elements" : [ { "distance" : { "text" : "1 m", "value" : 0 }, "duration" : { "text" : "1 min", "value" : 0 }, "status" : "ok" } ] } ], "status" : "ok" }
what doing wrong?
the problem not occused apache http client. google requires specify localiztion explicitely. probaly english localization works default. if append &language=ru
url, work correctly.
Comments
Post a Comment