角色 +在 HTTP Post 中转换为 %2B

发布于 2024-12-28 03:41:06 字数 288 浏览 2 评论 0原文

我正在向我们在工作中使用的 GM 脚本添加功能,但是当尝试发布(我可以跨站点添加)到另一个页面时,我的 CMD 发布值与页面上的值不同。

它应该是 Access+My+Account+Info,但发布的值变为 Access%2BMy%2BAccount%2BInfo。

所以我想我的问题是:什么正在逃避我的价值以及如何让它不逃避?如果没有办法摆脱它,有人有任何解决方法的想法吗?

谢谢!

我的问题

I'm adding functionality to a GM script we use here at work, but when trying to post (cross site may I add) to another page, my posting value of CMD is different than what it is on the page.

It's supposed to be Access+My+Account+Info but the value that is posted becomes Access%2BMy%2BAccount%2BInfo.

So I guess my question is: What's escaping my value and how do I make it not escape? And if there's no way to unescape it, does anyone have any ideas of a workaround?

Thanks!

My Issue

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

探春 2025-01-04 03:41:07

/data/v50.0/query?q=SELECT Id from Case

这对我有用。用空格代替“+”

/data/v50.0/query?q=SELECT Id from Case

This worked for me. Give space instead of '+'

挽清梦 2025-01-04 03:41:06

%2B+ 的代码。您(或您正在使用的任何框架)应该已经在服务器端解码 POST 数据......

%2B is the code for a +. You (or whatever framework you're using) should already be decoding the POST data server-side...

世俗缘 2025-01-04 03:41:06

快速说明一下:如果您想解码路径段,可以使用 UriUtils(spring 框架):

@Test
public void decodeUriPathSegment() {
   String pathSegment = "some_text%2B"; // encoded path segment
   String decodedText = UriUtils.decode(pathSegment, "UTF-8");
   System.out.println(decodedText);
   assertEquals("some_text+", decodedText);
}

Uri 路径段与 HTML 转义字符不同(请参阅 列表)。这是一个例子:

@Test
public void decodeHTMLEscape() {
    String someString = "some_text+";
    String stringJsoup = org.jsoup.parser.Parser.unescapeEntities(someString, false);
    String stringApacheCommons = StringEscapeUtils.unescapeHtml4(someString);
    String stringSpring = htmlUnescape(someString);

    assertEquals("some_text+", stringJsoup);
    assertEquals("some_text+", stringApacheCommons);
    assertEquals("some_text+", stringSpring);
}

Just a quick remark: If you want to decode a path segment, you can use UriUtils (spring framework):

@Test
public void decodeUriPathSegment() {
   String pathSegment = "some_text%2B"; // encoded path segment
   String decodedText = UriUtils.decode(pathSegment, "UTF-8");
   System.out.println(decodedText);
   assertEquals("some_text+", decodedText);
}

Uri path segments are different from HTML escape chars (see list). Here is an example:

@Test
public void decodeHTMLEscape() {
    String someString = "some_text+";
    String stringJsoup = org.jsoup.parser.Parser.unescapeEntities(someString, false);
    String stringApacheCommons = StringEscapeUtils.unescapeHtml4(someString);
    String stringSpring = htmlUnescape(someString);

    assertEquals("some_text+", stringJsoup);
    assertEquals("some_text+", stringApacheCommons);
    assertEquals("some_text+", stringSpring);
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文