Wrong encoding of `filename` parameter on FormData
See original GitHub issueWhen appending a File
object to a FormData
instance, the filename
parameter is set as is defined in the file name
attribute, throwing an exception if it includes non-ASCII characters. According to the spec, it must be encoded as ISO-8859-1, and ideally, also have a filename*
parameter with the name encoded as rfc-5987, so full Unicode characters can be used in the filename. To sanitize the filename
parameter to be ISO-8859-1, maybe the windows-1252 npm module could be used…
Environment
Environment:
OS: Linux 4.13
Node: 9.5.0
Yarn: Not Found
npm: 5.6.0
Watchman: 4.9.0
Xcode: N/A
Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed)
react: ^16.2.0 => 16.2.0
react-native: ^0.54.0 => 0.54.0
Expected Behavior
FormData instance would be able to encode a File
object (in fact, a React Native “blob”) with non-ASCII characters on its name (more exactly, spanish tildes).
Actual Behavior
Steps to Reproduce
- create a
FormData
instance - append a File object or ReactNative “blob” with non-ASCII characters in the name
- send the
FormData
usingfetch()
- crash
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
Wrong encoding of filename parameter on FormData #18486
When appending a File object to a FormData instance, the filename parameter is set as is defined in the file name attribute, ...
Read more >Java for Web - Multipart/form-data file with wrong encoding
The problem is that investigating this type of issue is very tricky, since there are many points in the code where the encoding...
Read more >Encoding problems when using multipart/form-data - Forums
The problem is, when the text contains special characters I get weird output - as if the request parameters aren't decoded using UTF-8....
Read more >"does not conform to the specification for multipart/form-data ...
Solution: There is a semicolon after the “filename” parameter of the file and this will lead to Asana not being able to parse...
Read more >RFC 7578 - Returning Values from Forms: multipart/form-data
The Charset Parameter for "text/plain" Form Data; 4.6. ... use multipart/form-data with file names directly encoded including octets outside the US-ASCII ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This issue was marked as lacking information required by the issue template. There has been no activity on this issue for a while, so I will go ahead and close it.
If you found this thread after encountering the same issue in the latest release, please feel free to create a new issue with up-to-date information by clicking here.
If you are the author of this issue and you believe this issue was closed in error (i.e. you have edited your issue to ensure it meets the template requirements), please let us know.
same issue