【问题标题】:How are non-ASCII file names encoded in RAR files?RAR 文件中的非 ASCII 文件名是如何编码的?
【发布时间】:2012-06-17 13:43:33
【问题描述】:

我有一个文件名中包含非 ASCII 字母的 RAR 文件。我尝试在 Delphi 中对其进行解码。我的代码适用于 ASCII 文件名,但在这些文件名上失败了。它不是 WideChar,也不是 UTF8。我在这里找到了 RAR 规格: http://ams.cern.ch/AMS/amsexch/arch/rar/technote.txt 但它没有说明字符编码。 我尝试了 WOTSIT.org,但所有指向 RAR 的链接都已失效(几乎每个链接都已失效;我什至联系了管理员,但他没有回复,也没有修复链接)。 好像不是 8bit 编码,但不知道是什么。

【问题讨论】:

标签: delphi character-encoding file-format rar


【解决方案1】:

这是唯一一段提到这个名字的段落:

0x200 - FILE_NAME contains both usual and encoded
        Unicode name separated by zero. In this case
        NAME_SIZE field is equal to the length
        of usual name plus encoded Unicode name plus 1.

        If this flag is present, but FILE_NAME does not
        contain zero bytes, it means that file name
        is encoded using UTF-8.

好像是UTF-8,你说不是。可以再试一次吗?

【讨论】:

  • 我尝试了 only ASCII 和 only UTF-8 而不是 both。我试试这个,谢谢。
  • 谢谢你,@nhahtdh。我不知道我是怎么错过这一段的,但是这个标志和 ANSII 和 UTF-8 之间的 0 确实可以解决问题!
猜你喜欢
  • 2014-03-07
  • 1970-01-01
  • 2016-07-05
  • 1970-01-01
  • 2023-03-28
  • 1970-01-01
  • 2018-04-12
  • 1970-01-01
  • 2020-05-13
相关资源
最近更新 更多