Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

post的时候FormatException: Bad UTF-8 encoding 0xc2 #60

Closed
sidealice opened this issue Sep 3, 2018 · 5 comments
Closed

post的时候FormatException: Bad UTF-8 encoding 0xc2 #60

sidealice opened this issue Sep 3, 2018 · 5 comments

Comments

@sidealice
Copy link

post 数据:
{entry: weibo, gateway: 1, from: , savestate: 7, useticket: 1, pagerefer: https://passport.weibo.com, vsnf: 1, su: MTM1NTQ5OTgyMjU=, service: miniblog, servertime: 1535992812, nonce: HCNYJ3, pwencode: rsa2, rsakv: 1330428213, sp: 505790cf67616561d46afd5ba4842540c749b7c274e0b658fd0ef417f90d82a321144dfa9206a74e71e832daa480a7e650d33ff385a5b99c1842f2144c0de75be316cdb690d69e50a9f6955d24ee765df1b1a551a0967d1f86d7d9c5d27b1fa2e609c086f6a8d30a261a16d419d827bffd907e14472ecc41a4a6b20f3181dd28, sr: 1366*768, encoding: UTF-8, prelt: 115, cdult: 38, url: http://weibo.com/ajaxlogin.php?framelogin=1&callback=parent.sinaSSOController.feedBackUrlCallBack, returntype: TEXT, door: 333}
请求的函数。
Response response = await httpRequest.post(
loginUrl,
data: loginPostData,
options: Options(
contentType: ContentType.json,
responseType: ResponseType.JSON,
headers: headers,
),
);

是否有办法调试?

@sidealice
Copy link
Author

dio.get其他是没问题的。
dart是2.1
flutter 是0.7.5

请教下这个utf8是否和post的无关,我有没有办法看到返回的数据?
即便是我改为text plain都是会报错的。 这个错误是哪里监测到的?

@sidealice
Copy link
Author

我用http的包post同样的数据可以获取return code是200,返回的body是json的数据。我在想问是否有没有可能是你们的代码里面做json解析哪里有问题?

@wendux
Copy link
Contributor

wendux commented Sep 4, 2018

@sidealice 加我qq我帮你调一下824783146

:octocat: From gitme Android

@sidealice
Copy link
Author

谢谢帮忙,耽误您这么久时间了。

@sidealice
Copy link
Author

sidealice commented Sep 4, 2018

问题是header里面的Content-Type和formData有冲突
自己写代码用常量HttpHeaders.contentTypeHeader可以避免。

AlexV525 added a commit that referenced this issue Feb 13, 2023
Signed-off-by: Luke Cheng <2258420+chenglu@users.noreply.github.com>

### Additional context and info (if any)

The pub.dev site suggests us to update the description to improve the score.
Please feel free to update my words, we will update the repo description on GitHub when we merged this PR.

Co-authored-by: Alex Li <github@alexv525.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants