逃脱加字符 [英] Escape plus character

查看:127
本文介绍了逃脱加字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我找到了逃避%(百分比)和<的方法code>_(下划线)喜欢[%][_]

但如何为角色+做同样的事情?



是否适用相同的方法?



我向服务发送一个参数并获得结果。

所以,我不能在SQL Server端做任何事情。

我只需要格式化参数并将其发送到服务,这样我就可以得到正确的结果。





我发现一个有趣的事情是,当我在文本框中输入+符号时,我只得到一个调试时代码后面的空白字符。我很困惑。

[/编辑]



谢谢,

Tadit

Hi All,

I found the methods to escape the "%"(Percentage) and "_"(Underscore) like "[%]" and "[_]".
But how to do the same for character "+" ?

Is the same method applies to it ?

I am sending one parameter to a service and getting the result.
So, I can't do anything in SQL Server side.
I only need to format the parameter and send that to service so that I can get the correct result.


One interesting thing I found is, when I enter "+" sign in the textbox, I am getting only a blank character in code behind while debugging. I am confused.
[/EDIT]

Thanks,
Tadit

推荐答案

注意:抱歉,我忘记更新此主题。只是添加答案,以便没有其他人因为那个时间而感到困惑。



问题出现了因为我没有编码 QueryString



因此,我使用 HttpUtility.UrlEncode 从第一页发送时编码。然后我在 QueryString 值中得到了+符号,没有任何其他问题。
Note : Sorry I forgot to update this thread. Just adding answer so that no one else get confused as I was that time.

The Problem was occurring because I have not Encoded the QueryString.

So, I encoded while sending from first page using HttpUtility.UrlEncode. Then I got the "+" sign in QueryString value perfectly without any other issues.


这篇关于逃脱加字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆