编码转换

URL 编码

对文本做 URL 百分号编码(encodeURIComponent 语义)。适合拼接查询参数。提供 component 与 path 两种模式:component 编码空格为 +,path 模式保留 / 等路径字符。

gongdana.encoding.url_encode

待编码文本

编码模式:component=查询参数(空格转+),path=路径(保留 / : @ 等)

结果

填写左侧参数后点击「计算」

参数说明

共 2 个参数,其中 1 个必填。表格由工具的 JSON Schema 自动生成。

参数类型必填约束说明
text字符串必填—待编码文本
mode字符串选填可选值:URI 组件(component) / 路径(path);默认 "component"编码模式:component=查询参数(空格转+),path=路径(保留 / : @ 等)

返回字段

  • encoded字符串(必有)
  • length整数

API 调用方式

示例使用默认值与首个枚举值,可直接运行

REST

curl -X POST {ORIGIN}/api/call \
  -H "Content-Type: application/json" \
  -d '{"tool":"gongdana.encoding.url_encode","input":{"text":"a b&c=d","mode":"component"}}'

MCP(JSON-RPC)

端点 {ORIGIN}/mcp;需先完成 initialize 握手。

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "gongdana.encoding.url_encode",
    "arguments": {
      "text": "a b&c=d",
      "mode": "component"
    }
  }
}

常见问题

URL 编码是做什么的?
对文本做 URL 百分号编码(encodeURIComponent 语义)。适合拼接查询参数。提供 component 与 path 两种模式:component 编码空格为 +,path 模式保留 / 等路径字符。 它属于「编码转换」分类,工具标识为 gongdana.encoding.url_encode。
URL 编码需要哪些参数?
必填参数 1 个:text(字符串)。另有选填参数 1 个:mode。
URL 编码返回什么结果?
返回 JSON 对象,主要字段:encoded(字符串(必有));length(整数)。
如何通过 API 调用URL 编码?
REST 方式:POST /api/call,请求体为 {"tool":"gongdana.encoding.url_encode","input":{...}}。MCP 方式:连接站点根路径下的 /mcp 后调用 tools/call,name 传 "gongdana.encoding.url_encode"。也可用批量(POST /api/batch)与链式(POST /api/chain)编排多个工具。
URL 编码的结果可以复现吗?
可以。该工具是纯函数,同样的输入永远得到同样的输出,不依赖时间、随机数或外部状态,因此结果可被交叉核对。

相关工具 · 编码转换

查看全部 20 个 →