2017-03-08 3 views
1

응답을 받고있는 GET 서비스가 있습니다.okhttp를 사용한 json 응답의 특수 문자 문제

URL : http://52.33.140.142:8080/TigerServlet/?command=GetAlerts&[email protected]&hours=0&tag=Android&device_token=APA91bHm-hjBFN-V9ygCJbSd6Bqo6ww27a_Z0tfxnsdbLiBC0TP03HpkLohThzL0bE69G_uBzId-kkIPnORdIe1LzA_no9h93HaawdAprbQhBRVo0QCtzz400PdoWWMBMBtmlXqGFwyV&language=en

==> 응답 : 나는 구글 크롬 등의 브라우저에서 URL 위에 열 때.

{ "success":"1", "data": [ { "address": "Hôtel de Ville, 75004 Paris, France", "email": "[email protected]", "username": "umeshfinal", "phone": "9033329824", "status": 0, "fld_help_id": 97979, "recieveremail": "[email protected]", "image": "http://services.defensealertdevice.com/admin/uploads/user_image/user_image_2094.png", "latitude": "48.8564817", "longitude": "2.3524133", "datetime": "2017-03-03 10:50:03.0", "alertType": 0 }, { "address": "Skíðabraut, Dalvík, Iceland", "email": "[email protected]", "username": "chil", "phone": "1234567890", "status": 0, "fld_help_id": 97981, "recieveremail": "[email protected]", "image": "http://services.defensealertdevice.com/admin/uploads/user_image/user_image_2843.png", "latitude": "65.9667", "longitude": "-18.5333", "datetime": "2017-03-03 10:34:51.0", "alertType": 4 }, } ], "message": "" } 

==> 응답 : 우편 클라이언트처럼 휴식 클라이언트에서 위 URL을 열 때.

{ "success":"1" "data": [ { "address": "H�tel de Ville, 75004 Paris, France", "email": "[email protected]", "username": "umeshfinal", "phone": "9033329824", "status": 0, "fld_help_id": 97979, "recieveremail": "[email protected]", "image": "http://services.defensealertdevice.com/admin/uploads/user_image/user_image_2094.png", "latitude": "48.8564817", "longitude": "2.3524133", "datetime": "2017-03-03 10:50:03.0", "alertType": 0 }, { "address": "Sk��abraut, Dalv�k, Iceland", "email": "[email protected]", "username": "chil", "phone": "1234567890", "status": 0, "fld_help_id": 97981, "recieveremail": "[email protected]", "image": "http://services.defensealertdevice.com/admin/uploads/user_image/user_image_2843.png", "latitude": "65.9667", "longitude": "-18.5333", "datetime": "2017-03-03 10:34:51.0", "alertType": 4 }, } ], "message": "" } 

==> 네트워크 통화에 okhttp를 사용하고 있는데 okhttp utf-8이 기본적으로 지원됩니다. ==> 서버 (바람둥이) 쪽에서도 utf-8을 설정하십시오. 대신에 특수 문자의 실제 유니 코드의 유니 코드 ufffd에

==> 아직도 내가 점점 오전 = \.]

==> 또한 나는 URLDecoder.decode ("문자열")과 같은 변환 프로세스를했다.

==> 아직 실제 특수 문자를 얻을 수 없습니다.

==> 안드로이드 측 또는 서버 측에서이 문제가 발생하는지 이해할 수 없습니다.

+0

응답 헤더를 인쇄 하시겠습니까? Content-Type 헤더는 힌트를 제공 할 수 있습니다. –

+0

응답 헤더 : 요청 {방법 = GET, URL = HTTP : //52.33.140.142 : 8080/TigerServlet command=GetAlerts&[email protected]&hours=0&tag=Android&device_token=APA91bHm-hjBFN-V9ygCJbSd6Bqo6ww27a_Z0tfxnsdbLiBC0TP03HpkLohThzL0bE69G_uBzId-kkIPnORdIe1LzA_no9h93HaawdAprbQhBRVo0QCtzz400PdoWWMBMBtmlXqGFwyV&language=en, 태그 = null} –

+0

응답 헤더를 인쇄 하시겠습니까? 응답이 아니라 머리글입니다. –

답변

0

한 달을 보낸 후, 나는이 문제를 서버 측에서 실제로 해결했습니다. 우리는 서버 측에 메타 태그를 설정해야합니다.

해피 코딩.

+0

어떻게 서버쪽에 메타 태그를 설정할 수 있습니까? 친절하게 이것을 자세히 설명합니다. – Veswanth