multer
multer copied to clipboard
accept utf8 filenames
This PR should fix #1015 #1104
maybe It would be nice to be able to specify what encoding to use instead. Changing the default encoding will be a breaking change. What about people that don't want/can't use utf8?
Sorry for the late response on this.
It feels like this is a breaking change? In that case I don't see how we could get it into the 1.x release, but maybe we can do the same change in the 2.x branch? (#399)
It feels like this is a breaking change?
yes, because currently, people are using the Buffer.from(filename, 'latin1').toString('utf8');
trick.
If we parse an utf8 string as latin1 it will spit out garbage.
That's why I suggested only adding an option to change the encoding as a config option but leaving the default one as is to not break existing setups.
but maybe we can do the same change in the 2.x branch?
sounds good as well
@LinusU I created a different PR that doesn't break backward compatibility - it extends the multer's API with a default defParamCharset: 'latin1'
value
Also, improved the translations
https://github.com/expressjs/multer/pull/1210