Pyftplib Chinese garbled problem solution

Time:2021-2-27

This article mainly introduces the pyftplib Chinese garbled problem solution, the article through the example code introduction is very detailed, for everyone’s study or work has a certain reference learning value, need friends can refer to

Using pyftpdlib to start the FTP server, FTP client when uploading files, if you do not specify the character code, if you encounter Chinese, it may be garbled; found a lot of information on the Internet, but their client is based on python. Still can’t solve my problem

So, we need to re code the method of ftphandler


def decode(self, bytes):
  return bytes.decode('utf-8', self.unicode_errors)

Changing UTF-8 to GBK can solve the problem perfectly

The above is the whole content of this article, I hope to help you learn, and I hope you can support developer more.

Recommended Today

Tutorial on sending e-mail using net:: SMTP class in Ruby

Simple Mail Transfer Protocol(SMTP)SendE-mailAnd routing protocol processing between e-mail servers. RubyIt provides the connection of simple mail transfer protocol (SMTP) client of net:: SMTP class, and provides two new methods: new and start New takes two parameters: Server name defaults to localhost Port number defaults to 25 The start method takes these parameters: Server – […]