In method ChannelSftp.setFilenameEncoding() there is a version check that causes an error for any attempt to set a file name encoding on a server implementing SFTP protocol versions 3, 4 or 5.
Protocol version 3 doesn't define a default encoding so it is exactly that version I would require this functionality most.
I didn't find in the specs that SFTP protocol versions greater 3 are limited to UTF-8 encoding. As far as I understand it is just a default (RFC 2640: "pathnames ... SHOULD be ... UTF-8 encoded"). So if a server is configured to use any other encoding this functionality is still required.
It seems that error #1 has been introduced after the method has been implemented for the first time, at least the proposal in https://email@example.com/msg00089.html only checks for a protocol version greater than 3.
Please completely remove the protocol version check from this method.