19 lines
496 B
C++
19 lines
496 B
C++
#pragma once
|
|
#include <string>
|
|
|
|
namespace urlcodec
|
|
{
|
|
// 编码函数:将输入字符串进行 URL 编码
|
|
// 类似于 Python 的 urllib.parse.quote
|
|
// 输入:原始字符串
|
|
// 输出:编码后的字符串
|
|
std::string url_encode(const std::string& input);
|
|
|
|
// 解码函数:将 URL 编码的字符串解码为原始字符串
|
|
// 类似于 Python 的 urllib.parse.unquote
|
|
// 输入:编码后的字符串
|
|
// 输出:原始字符串
|
|
// 返回值:true 表示解码成功,false 表示解码过程中出现错误
|
|
bool url_decode(const std::string& input, std::string& output);
|
|
}
|