我需要使用标准libs对这样的字符串进行编码: {some-string.for#encode} “收件人” %7bsome%2dstring%2efor%23encode%7d"
{some-string.for#encode}
%7bsome%2dstring%2efor%23encode%7d"
HttpUtility.UrlDecode("{some-string.for#encode}")
无法按预期工作并返回:
%7某些字符串。对于%23编码%7d”
原因是 - 和 . section 2.3 of rfc3986 明确允许 它们是“未保留”字符。因此,没有 符合标准 编码器百分比 做 这与它们不编码“some”(即 而且 第2.3节的一部分,通过标签 ALPHA ).
-
.
ALPHA
因此:如果你不打算遵循规范,你必须自己编写编码器。