티스토리 뷰
http 패키지(https://pub.dartlang.org/packages/http) 를 이용하여 문자열을 내려 받을때 한글이 깨지는 경우
final response = await http
.post('https://targeturl.pr.kr', body: {'userid' : userid.text, 'userpw' : userpw.text})
.timeout(Duration(seconds: 3));
if (response.statusCode == 200) {
print('데이터 수신 ' + response.contentLength.toString() + 'byte');
print(response.body); // 한글 깨짐
print(utf8.decode(response.bodyBytes)); // 한글이 깨지는 문제를 해결
}
결과
I/flutter ( 936): 데이터 수신 73byte
I/flutter ( 936): {"RESULT":"OK","MESSAGE":"ë¡ê·¸ì¸ ëììµëë¤.","NEXTPAGE":"/main"}
I/flutter ( 936): {"RESULT":"OK","MESSAGE":"로그인 되었습니다.","NEXTPAGE":"/main"}
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- dart
- Mobile
- gpkiapi
- devtools
- JavaScript
- 맛집
- Review
- place
- samba
- 엘리스센터
- HTTP
- Compile
- Fun
- Security
- Android
- json parse
- Linux
- kotlin
- springboot
- TIP
- ssh
- MySQL
- Spring
- development
- devel
- Flutter
- SSL
- web
- Java
- food
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함