【问题标题】:Encode and Decode rfc2396 URLs in Nim在 Nim 中编码和解码 rfc2396 URL
【发布时间】:2021-11-30 12:32:27
【问题描述】:

我正在开发一个可用作 cli 垃圾应用程序的应用程序(我知道垃圾 CLI 存在,这是一个个人项目 :)),我遇到的一个问题是您的垃圾信息(当您移动要丢弃的东西,会生成一个信息文件来存储它的原始位置)以 RFC 2396 格式存储信息,因此空格变为%20,而左括号变为%28。 (这里是一个例子:/home/netsu/Documents/Music%20%28copy%29

我的问题是,如何在 Nim 中将 /home/netsu/Documents/Music (copy) 转换为 /home/netsu/Documents/Music%20%28copy%29 并反之亦然? Python 有像 urllib.urlencode 这样的东西,我相信它可以做到这一点,但我不知道 Nim 中有这么有用的功能。

【问题讨论】:

    标签: url urlencode nim-lang urldecode rfc2396


    【解决方案1】:

    你可以看看uri.encodeUrl和uri.decodeUrl:https://nim-lang.org/docs/uri.html#encodeUrl%2Cstring

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-09-29
      • 1970-01-01
      • 2015-12-05
      • 1970-01-01
      • 2019-06-01
      • 2018-10-18
      • 2011-08-05
      • 1970-01-01
      相关资源
      最近更新 更多