fixed issues : Have exception if playing Chinese song #171 (#174)

This commit is contained in:
tyutony 2017-08-29 22:52:34 +08:00 committed by Jonas Dellinger
parent 8f76b4c36f
commit 04c1687cec

View File

@ -51,8 +51,6 @@ namespace SpotifyAPI.Local
return null; return null;
} }
response = response.Replace("\\n", ""); response = response.Replace("\\n", "");
byte[] bytes = Encoding.Default.GetBytes(response);
response = Encoding.UTF8.GetString(bytes);
List<StatusResponse> raw = JsonConvert.DeserializeObject<List<StatusResponse>>(response); List<StatusResponse> raw = JsonConvert.DeserializeObject<List<StatusResponse>>(response);
return raw[0]; return raw[0];
} }
@ -110,7 +108,10 @@ namespace SpotifyAPI.Local
using (var wc = new ExtendedWebClient()) using (var wc = new ExtendedWebClient())
{ {
if (SpotifyLocalAPI.IsSpotifyRunning()) if (SpotifyLocalAPI.IsSpotifyRunning())
{
wc.Encoding = Encoding.UTF8;
response = "[ " + wc.DownloadString(address) + " ]"; response = "[ " + wc.DownloadString(address) + " ]";
}
} }
} }
catch catch