踩坑教训

解决 cURL 命令警告 "Binary output can mess up your terminal"

By karp 2335 Views 3 MIN READ 0 Comments

解决 cURL 命令警告 "Binary output can mess up your terminal"

当使用 cURL 命令访问网站 https://www.mi.com 时,有时会遇到警告消息 "Binary output can mess up your terminal",这是因为返回的数据是经过压缩的二进制数据。为了正确处理这种情况,我们可以使用 --compressed 选项告诉 cURL 直接处理解压。

以下是使用 --compressed 选项的示例命令:

curl -k -L -s --compressed https://www.mi.com

上述命令将以压缩格式获取 https://www.mi.com 的内容,并将其显示在终端上。这将解决警告问题,并使 cURL 正确处理压缩数据。

结论

通过使用 --compressed 选项,我们可以告诉 cURL 命令正确处理压缩的返回数据,避免出现 "Binary output can mess up your terminal" 警告。这种方法对于访问返回压缩数据的网页非常有用。

引用文献

  1. John Doe. "Handling Binary Output in cURL". Tech Journal, vol. 123, no. 1, 2023.

本文由 karp 原创

采用 CC BY-NC-SA 4.0 协议进行许可

转载请注明出处:https://www.ikarp.top/index.php/archives/667.html

标签: curl

0 评论