FTP文件名编码 [英] FTP filename encoding

查看:330
本文介绍了FTP文件名编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi
我使用扭曲库连接到FTP服务器,但是我有文件名编码问题。
我收到'Illusion-N\xf3z.txt',所以它不是unicode。有没有FTP命令强制特定的编码?
提前感谢!
MK

Hi I use twisted library to connect to FTP server but I have problem with filename encoding. I receive 'Illusion-N\xf3z.txt' so its not unicode. Is there any FTP command to force specific encoding? Thanks in advance! MK

推荐答案

有两种可能性:


  • FTP不是unicode感知。在这个例子中看起来像你正在说话的服务器是发送Latin-1编码的字节。所以你需要使用这个编码对字节进行解码。

  • 有一个一个RFC ,它将FTP更新为UTF-8感知。检查 FEAT 命令的结果,看看 UTF8 是否存在(但可能不是,因为示例字节无效UTF-8)。如果是,则使用UTF-8对字节进行解码。

  • FTP is not unicode aware. It looks like the server you're talking to in this example is sending Latin-1 encoded bytes. So you need to decode the bytes using that encoding when you receive them.
  • There is an RFC which updates FTP to be UTF-8-aware. Check the results of the FEAT command to see if UTF8 is there (but it probably isn't, since the example bytes are not valid UTF-8). If it is, decode the bytes using UTF-8.

Twisted的FTP客户端不会对其进行任何与Unicode相关的操作,因为它只是实现了基本的FTP RFC。

Twisted's FTP client won't do anything unicode-related for it, since it just implements the basic FTP RFC.

这篇关于FTP文件名编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆