0

I'm retrieving from geonames the names of locations (that should have unconventional characters depending by the country): for example:

http://api.geonames.org/findNearbyPostalCodesJSON?lat=40.826523&lng=26.918055&radius=21&maxRows=24&username=demo

retrieve this:

{
    adminCode2: "8632559",
    adminCode1: "59",
    adminName2: "Malkara",
    lng: 26.964775,
    distance: "6.73594",
    countryCode: "TR",
    postalCode: "59300",
    adminName1: "Tekirdağ",
    placeName: "Çavuşköy",
    lat: 40.875728
},

and when I download with

var json = new System.Net.WebClient().DownloadString(url);

I get this:

{
    "adminCode2":"8632559",
    "adminCode1":"59",
    "adminName2":"Malkara",
    "lng":26.964775,
    "distance":"6.73594",
    "countryCode":"TR",
    "postalCode":"59300",
    "adminName1":"TekirdaÄŸ",
    "placeName":"Çavuşköy",
    "lat":40.875728
},

any ideas on how to convert directly all the string to get the right names?

thanks in advance!

ghiboz
  • 7,863
  • 21
  • 85
  • 131

1 Answers1

0

You can try to add header:

var client = new System.Net.WebClient();

client.Headers["Accept-Language"] = "tr-TR";

client.DownloadString(url);
Adam Stawarek
  • 321
  • 4
  • 9