Google geocoding api search with Arabic language a

2019-07-22 07:55发布

问题:

I am passing arabic lang search text in Google geocoding api query, but returns no result in json

string strResult="http://maps.googleapis.com/maps/api/geocode/json?address=جدة +السليمانية "&sensor=false&language=ar";

gives

{ "results" : [], "status" : "INVALID_REQUEST" }

kindly suggest the correctway of passing arabiclanguage search text in url.

回答1:

You must encode the address-part, it should be:

http://maps.googleapis.com/maps/api/geocode/json?address=%D8%AC%D8%AF%D8%A9+%2B%D8%A7%D9%84%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86%D9%8A%D8%A9+%22&sensor=false&language=ar

How to encode it depends on the used programming-language