Guo
Guo

Reputation: 1803

Detecting FTP server file name encoding using Apache Commons Net

Is there a simple way to get or detect FTP server file name encoding using Apache Commons Net?
Why FileZilla client can always get right encoding and show right file name? How does it do that?

Upvotes: 0

Views: 1037

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202360

There's no way to find out, what encoding does the server use.

I do not even think that FileZilla can always show the right file name.
See https://wiki.filezilla-project.org/Character_Encoding

Having that said, you may consider these:

  • Some FTP clients (including FileZilla) send OPTS UTF8 ON command to the FTP server at the beginning of session, to try to force the server use UTF-8 encoding. IIS or ProFTPD servers respond to this.
  • Do some heuristics when detecting the encoding.

Upvotes: 2

Related Questions