Upload files on ftp, garbled in Chinese

use the ftp package of nodejs to upload a pdf file containing Chinese to the server, and the open file is garbled.

c.put(filepath, dir + day + "/" + fileName, function (err) {
            console.log("upload err", err);
            // if(!err){
            //   fs.unlinkSync("./../uploads/" + fileName)//
            // }
            c.end();
          });

clipboard.png

is there any way to deal with it?

Apr.17,2021

it's not garbled, it's missing fonts! FTP is just a transport protocol and will not modify the contents of your file.


this is because the encoding corresponding to the configuration of your uploaded file does not match the encoding of the uploaded file, or the encoding of the file opened by FTP's editor does not match the encoding of the file. Just set it to use utf8 uniformly

.
Menu