0

I am using multer's upload.single to extract a csv file from request. When converting the buffer given by multer's upload fn to string, I observed localized text characters (like À) are getting converted to some random character( like � ).The encoding which multer uses is 7bit. Is there any way to get data in utf-8 encoding.

contentType: multipart/form-data; boundary=--------------------------685735458832809176548913

Multer's file details:

fieldname: 'file',
originalname: 'Sample.csv',
encoding: '7bit',
mimetype: 'text/csv',
4

1 回答 1

0

我找到了解决这个问题的方法,当将缓冲区转换为字符串时,添加“latin1”作为编码

request.file.buffer.toString('latin1')
于 2020-01-29T15:10:45.663 回答