I'm struggling with wrong encoded multipart form filenames uploaded to a nodejs backend.
Running the node application locally works as expected and the filenames arrive with propert utf-8 encoding. As soon as i run the application in a docker environment the backend receives scrambled filenames.
I'm using the express-fileupload package.
JSON Content in the same request is properly encoded..
Backend:
router.post('/upload', async (req: any, res) => {
let formDataFiles = req.files;
});
http response header seems correct as well: content-type application/json; charset=utf-8
I'm not sure where to look. Where does nodejs take the encoding from?
Ok i found the solution.
express-fileuploaduses busboy under the hood. You can pass in busboy options and one of them isdefParamCharset:The documentation states
Default: 'latin1'.but in my case it was dependent on the running OS!If you initialize the middleware as following it should properly UTF8 encode filenames: