4
The method below is extracting data from a JSON file, to fill a Dropdownlist.
public static List<Uf> GetAll()
{
var client = new WebClient();
JsonSerializerSettings settings = new JsonSerializerSettings();
settings.Culture = new System.Globalization.CultureInfo("pt-BR");
var response = client.DownloadString(new Uri(HttpContext.Current.Server.MapPath("~/Scripts/uf.json")));
var lista = JsonConvert.DeserializeObject<List<Uf>>(response, settings);
return lista;
}
But when it returns this to the Browser, it displays the accented characters with strange codes.
How can I display characters with correct accentuation?
I was trying to change the encoding at the time of presenting the data but not at the time of downloading. It worked. Thank you.
– Otavio Camargo