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

FormData & Files Encoding #570

Open
bim-oulabi opened this issue Mar 31, 2024 · 2 comments
Open

FormData & Files Encoding #570

bim-oulabi opened this issue Mar 31, 2024 · 2 comments

Comments

@bim-oulabi
Copy link

bim-oulabi commented Mar 31, 2024

Trying to post a formdata shows weird symbols as shown in the screen shot when and only when a file is appended to the formdata and when the values are in non-english language,

form example

const formdata = new FormData();
formdata.append('file', {SomeFileFromAnInput}, 'filename.pdf');
formdata.append('name','هلا هلا');

ky.post('/demo', {
  body: formdata
});

with ky
image

with plain fetch
image

@sholladay
Copy link
Collaborator

Strange! Is the file necessary to reproduce the problem? I can't reproduce, at least with just name on its own.

The raw request body that I see in Safari is:

------WebKitFormBoundaryJfZe6JJ5hninzVux
Content-Disposition: form-data; name="name"

هلا هلا
------WebKitFormBoundaryJfZe6JJ5hninzVux--

@bim-oulabi
Copy link
Author

Yes the file is necessary to reproduce it,

Somehow it works fine in the BE and data is recieved correctly if parsed

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