The problem is as follows. I send a request to the server as follows.

$http({ url: url, method: "GET", mimeType: "text/html; charset=UTF-8", params: { groupId: groupId }, headers: { "Header-Type": "charset=UTF-8", "Accept-Language": "en-US,en,ru-ru" } }).then(function (result) { if (result.data !== "") { $scope.filterDetails = result.data; filterList = JSON.parse(result.headers("filterList")); $scope.isListEmpty = false; } else { $scope.isListEmpty = true; } }, function (result) { alert(result.data); }); 

in the controller add header filterList.

  List<SiteFilter> result = SiteFilterRepository.GetFilterList(groupId); JavaScriptSerializer serializer = new JavaScriptSerializer(); string str = serializer.Serialize(result); Response.HeaderEncoding = Encoding.UTF8; Response.AppendHeader("filterList", str); Response.Charset = "utf-8"; if (result != null) { return View("~/Views/SavedSearches/SavedSearchesDetails.cshtml", groupId); } else { return View("~/Views/SavedSearches/SavedSearchesDetails.cshtml", groupId); } 

Which looks like this " [{\"Id\":85,\"FilterGroupId\":68,\"Parameter\":\"CallId\",\"Condition\":\"Равно\",\"Value\":\"4\"}]"

In the line filterList = JSON.parse(result.headers("filterList")); getting

 [{"Id":85,"FilterGroupId":68,"Parameter":"CallId","Condition":"Равно","Value":"4"}] 

With what it can be connected?

    1 answer 1

    Solved the problem by filterList = decodeURIComponent(escape(result.headers("filterList"))); that is, I first convert the Response to the escape sequence because it is in a string in the ISO-8859-1 format. Why JS only perceives this encoding has not yet figured out.