Documentation Index
Fetch the complete documentation index at: https://docs-docflow.textin.com/llms.txt
Use this file to discover all available pages before exploring further.
在使用 DocFlow API 时,如果文件类别名称是中文或其他非英语字符,直接传递原始类别名称可能会导致以下问题:
- 类别匹配失败:API 无法正确识别中文类别名称
- 处理错误:返回类别不存在的错误信息
- 编码问题:URL 参数包含非 ASCII 字符导致请求失败
解决方案
1. URL 编码处理
中文类别名称必须进行 UTF-8 URL 编码后才能作为 API 参数传递。
Python 示例
import urllib.parse
# 原始中文类别名称
category = "发票"
# URL 编码
encoded_category = urllib.parse.quote(category)
print(f"编码后: {encoded_category}")
# 输出: %E5%8F%91%E7%A5%A8
JavaScript 示例
// 原始中文类别名称
const category = "发票";
// URL 编码
const encodedCategory = encodeURIComponent(category);
console.log(`编码后: ${encodedCategory}`);
// 输出: %E5%8F%91%E7%A5%A8