0

I'm trying to download a .json file from the following url to use the player names elsewhere:

https://example/players.json

It is a list of football players.

Some of the football players have accents in their names like Ibrahimović.

        string eaplay = "https://fifa17.content.easports.com/fifa/fltOnlineAssets/CC8267B6-0817-4842-BB6A-A20F88B05418/2017/fut/items/web/players.json";

        string eaResult = wb.DownloadString(eaplay);
        JObject jo = JObject.Parse(eaResult);

        string playerName = jo["Players"][10]["l"].ToString();

10 is NOT the index in which last name of ibrahimovic resides but this is an example.

I use playerName to then add to a class which I will then write to a .json file, however the player Ibrahimović is now stored as Ibrahimović.

I wouldn't mind being able to load them so Ibrahimović would be Ibrahimovic but even with the accent would be great.

I've tried serialising players.json using string options EscapeNonASCII with no avail. When I download the players.json and open it in Notepad++ the accents are encoded correctly.

Corona
  • 375
  • 5
  • 21
  • 2
    Did you try to encode them in c# with UTF8 ? – DomeTune Jan 15 '17 at 21:46
  • 3
    Set `webClient.Encoding = Encoding.UTF8;` before download as is shown in [WebClient.DownloadString results in mangled characters due to encoding issues, but the browser is OK](http://stackoverflow.com/a/7137997/3744182). – dbc Jan 15 '17 at 22:16

0 Answers0