Filename encoding in Apache Commons Net FTPClient

前端 未结 2 931
孤街浪徒
孤街浪徒 2021-02-13 14:31

I have to upload a file to an FTP server. The filename contains special letters, say äöü. On the FTP server, I need the filename to be UTF-8 encoded.

My cod

相关标签:
2条回答
  • 2021-02-13 15:13

    Since Apache Commons NET 3.0 one can use ftpClient.setAutodetectUTF8( true ); to enable autodetection of UTF-8 support on the FTP server. Like setControlEncoding it must be called before connection.

    See the corresponding javadoc.

    0 讨论(0)
  • 2021-02-13 15:19

    I have not tested it, but you can try this:

    client.setControlEncoding("UTF-8");
    
    0 讨论(0)
提交回复
热议问题