유니코드가 인코딩이 제대로 되지않았기 때문이다.
try {
String errorBody = response.errorBody().string(); // 에러바디를 String으로 변환
JSONObject jsonObject = new JSONObject(errorBody); // String을 JSON으로 변환
String errorMessage = jsonObject.getString("error"); // JSON에서 error 키의 값을 가져옴
Log.i("REGISTER_ACTIVITY1", errorMessage);
// else if errorMessage == 이미 존재하는 이메일입니다. 이런식으로
// 오류 메시지 처리
} catch (Exception e) { // 에러바디를 String으로 변환하는 과정에서 에러가 발생할 수 있음
e.printStackTrace();
// 오류 처리
}
'Android' 카테고리의 다른 글
fragment에서 activity 로 이동할때 LifeCycle을 Log로 확인 (0) | 2023.03.21 |
---|---|
Retrofit2 cache & Wireshark packet capture (0) | 2023.03.20 |
뷰 결합 FragmentBinding, 결합클래스의 개념 (0) | 2023.02.23 |
Android Fragment lifeCycle (0) | 2023.02.23 |
Android 내 현재 위치를 기반으로 주변 상점검색, GPS, 구글맵, retrofit2 (0) | 2023.02.16 |