gpt4 book ai didi

c# - 计算 URI 编码字符串中的实际字符

转载 作者:太空宇宙 更新时间:2023-11-03 20:16:09 24 4
gpt4 key购买 nike

在客户端,我有一个文本区域,我像这样提取它的值:

var TheURIEncodedString = encodeURI($('#TheTextArea').val());

字符串看起来像这样:

"This%20is%20a%20test%0AThis%20is%20a%20new%20line"

我通过 ajax 发送这个字符串,当我在服务器上接收到它时,我需要计算实际字符的数量,而不是字符串的长度。

我该怎么做?

最佳答案

使用HtppUtility.UrlDecode :

HttpUtility.UrlDecode("This%20is%20a%20test%0AThis%20is%20a%20new%20line").Length;

结果:

This is a test
This is a new line

关于c# - 计算 URI 编码字符串中的实际字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16585556/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com