encDecode

Version 23.4.8843


encDecode


解码已经编码文件或者字符串。

必需的参数

你需要提供下面任一参数,但不用全都传入:

  • data: 需要解码的数据。
  • file: 需要解码的文件。

可选的参数

  • format: 解码格式。可选项为:BASE64, HEX, HTML, JIS, QP, URL, UU, 和 YENC。默认值是 BASE64。
  • outfile: 用来保存解码数据的文件。这个属性不支持 UU 解码,因为其文件名已经指定。
  • outformat: 解码后数据的格式。可选项为:RAW, BASE64, 和 HEX。默认值为 RAW。

输出属性

  • decodeddata: 解码后的数据。
  • format: 解码后数据的格式。
  • outfile: 如果你指定了参数 outfile,这个就是文件名。

示例

以下 ArcScript 代码放置在 Script 端口 中时,从 [FilePath] 处的输入文件读取 BASE64 编码的数据,对其进行解码,然后将文件推出:

<!-- 设置输入项的文件和编码格式 -->
<arc:set attr="enc.file" value="[FilePath]" />
<arc:set attr="enc.format" value="BASE64" />

<arc:call op="encDecode" in="enc" out="result">
  <!-- 将输出文件数据设置为操作返回的解码数据 -->
  <arc:set attr="output.data">[result.decodeddata]</arc:set>
</arc:call>

<!-- 设置文件名并将文件输出 -->
<arc:set attr="output.filename" value="[FileName]" />
<arc:push item="output" />

其他资源

以下文章是使用 encEncode 操作的实际用例: