-
Notifications
You must be signed in to change notification settings - Fork 366
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
http.MultipartRequest with utf-8 support for body fields #159
Comments
I'm not sure I understand exactly what's going on. You say "when a body field contains characters such as é à ç, the field is reset to empty"... what does it mean for the field to be "reset to empty"? Is the field empty in the in-flight request data? Or are you checking based on how the server treats the data? Are you sure it's not an issue with the server's handling of UTF-8? |
Thanks. My form in my mobile application mainly contains two text inputs (title and content) and one file input (for image).
Dart http.MultipartRequest works well with my implementation. However, I'm in France, and we have letters such as é à ç ö etc, so when filling my form in French with those characters, on the server side, the body parameters are empty ! I think it is a utf8 issue with http.MultipartRequest ? |
Does anybody can help me?
But if I write |
Can you post a pure-Dart reproduction, that includes server code as well? |
Damn, I got this issue too...... I think this is imergency cause Not-English has seriously problem with I wanna suggested Flutter authors or it's contributors work on this issue quickly, cause flutter is groth very fast, but this basic package are still with so many bugs... Just report this, help solve it very soon. BTW, @Eimji Did'u find any solution on this? # |
Hello I didn't find any solution. My backend implementation works (tested with Postman and browser) I tried many workarounds to fix the issue but no success. Due to deadlines in my dev planning, I finally implemented a trick in my Flutter application. Instead of sending one POST request with multipart I send two successive POST requests: one for text inputs and one for file inputs. Not the best workaround but it works! I will post a sample code in Dart for client and in Go for backend to reproduce the issue |
@Eimji @jinfagang In my flutter app, I commented on the following code, I got the Go backend to recognize it properly.
|
Did you find any answer to this? I am also facing the same |
please follow my code, It's not working when upload file audio and video, please help me!
request.files.add(await http.MultipartFile.fromPath(
this is error show log |
I'm getting the same error for Arabic. |
any solution i face that in arabic |
So I faced the same issue too (using utf8 / non-ascii charset) when doing http.MutipartRequest with slightly a different result:
In my case the dart backend threw So I just changed the source to the commit id directly and it works ok now.
|
I'm also having this problem with a backend made with Angel Framework |
Any dart backend is having this issue. But the funny thing is that Postman can send the same data and dart will accept it normally. I've been struggling with it for several days already and still haven't found a solution |
I made a fork of the Angel Framework, called Galileo Framework which is working very well for me, even without this problem and already updated to work with dart 2.12, I use it already in production together with AngularDart 6 with dart 2.12 without problems. |
Hi
Hi! Thanks but this is not really a solution, at least for me because I'm using Jaguar (I'll take a look at your framework though, for further projects maybe). I found a true reason why it happens. It happens because dart formdata adds a content-transport-encoding: binary for all text fields that are non english. Probably dart 2.12 already has a fix for this but I didn't check. I've implemented FormData and created my on class that sends them without this header. BTW Postman also doesn't add this header. So, it's not only a backend or frontend error but an error of dart in all |
Facing same issue with spanish accent characters. As HTTP client I'm using dio with multipart support. The funny thing is that dio's default request encoder is UTF8 which would normally work with different language and culture charsets. |
I have the same problem, any solution??? |
Without additional information we're not able to resolve this issue. Feel free to add more info or respond to any questions above and we can reopen the case. Thanks for your contribution! |
Hello
As suggested here, I would like to submit one issue with
http.MultipartRequest
. How to support utf-8 format for the body fields?I'm writing a Flutter application, which includes a form to upload one image along with form fields
This code for making a POST as multipart/form-data works well, but whan a body field contains characters such as é à ç, the field is reset to empty. So my question is how can I make a post multipart/form-data with fields in utf-8 ?
Trying to add
request.headers[HttpHeaders.CONTENT_TYPE] = 'multipart/form-data;charset=utf-8';
does not change.Thanks a lot in advance
The text was updated successfully, but these errors were encountered: