MonoTouch iPhone 응용 프로그램에서 UTF-8을 지원해야하며 ANSI 대신 UTF-8로 인코딩되도록 모든 서버 PHP 스크립트를 업데이트해야합니다.ServiceStack JsonSerializer.DeserializeFromString이 UTF-8 문자열에서 작동하지 않습니다.
이 변경으로 인해 클라이언트 코드가 손상되고 PHP 스크립트에서 반환 된 문자열을 직렬화하려고 할 때 예외가 ServiceStack에서 발생합니다.
using (StreamReader reader = new StreamReader (webResponse.GetResponseStream(), Encoding.UTF8))
{
string responseString = reader.ReadToEnd();
myDto = JsonSerializer.DeserializeFromString (responseString, dtoType);
}
Exception: System.Runtime.Serialization.SerializationException: Type definitions should start with a '{', expecting serialized type 'UserGamesDTO', got string starting with: {"uc":"0","gma":[{"gid":"838","ui
는 예외 문자열로 시작하지 않는 불평하는 '{'가 명확하지 때, 그래서 이것은 ServiceStack이 UTF-8 문자열과 함께 작동하지 않을 수 있음을 의미, 또는 뭔가를 설정해야합니까 ?
감사합니다.
입니다 json.net 라이브러리를 사용하십시오? – I4V
안녕하세요 I4V, ContentEncoding이 비어 있습니다. 그래서 내 PHP 스크립트에서 UTF-8을 지정해야한다는 뜻입니까? 감사. – danfordham