freesoftwarefactory / parse-multipart

A javascript/nodejs multipart/form-data parser which operates on raw data.
MIT License
48 stars 79 forks source link

Special character like é ,ó , é are not getting properly parsed #24

Open kashifaliquazi opened 4 years ago

kashifaliquazi commented 4 years ago

Special character like é ,ó , é are not getting properly parsed

for example

éviépinóé is converting to éviépinóé.

We are not sure which part on parsing is causing the issue and how to fix this.

juicycool92 commented 2 years ago

same here with Korean. any hint?

kkiwan commented 2 years ago

@juicycool92

const bodyBuffer = Buffer.from(event['body-json'].toString(), 'base64');
const boundary = multipart.getBoundary(
    event.params.header['Content-Type'] || event.params.header['content-type']
);
const parts = multipart.Parse(bodyBuffer, boundary);
const { filename } = parts[0];
console.log('filename ===>', filename);    // á\x84\x82á\x85¡á\x84\x8Bá\x85´á\x84\x91á\x85¡á\x84\x8Bá\x85µá\x86¯.png
let filename_ = Buffer.from(filename, 'binary').toString();
console.log('filename_ ===>', filename_);    // 나의파일.jpg