如何解决“URL 格式错误”错误?
我想传递一个参数字符串,包括样式标签,例如:
a:"<font color=blue>testing!@#$%^&*()_+{}|:"<>?-=[]\;',./"
我使用decodeURI来传递字符串。但在extjs中仍然出现错误。
我已经检查过,是一个符号%导致这个错误出现。
怎么解决呢??
I want to pass a params string include style Tag like example:
a:"<font color=blue>testing!@#$%^&*()_+{}|:"<>?-=[]\;',./"
i am using decodeURI to pass the string.but still got error in extjs.
I has been checked,is a symbol % cause this error come out.
How to solve it??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不确定我是否完全理解您的问题,但您可能应该从转义字符串开始,以防止第二个
"
终止您的字符串。您可以通过语法突出显示原始字符串提前终止。
通过使用转义字符
\
你可以告诉 JS 将第二个"
解释为字符串的一部分,而不是字符串终止符。您还应该转义字符串末尾附近的\
字符,以防止 JS 认为您正在使用它来转义;
字符。Not sure that I understand your question completely, but you should probably start by escaping your string to prevent the second
"
from terminating your string.You can tell by the syntax highlighting that the original string is terminated premature.
By using the escape character
\
you can tell JS to interpret the second"
as part of the string, and not a string terminator. You should also escape the\
character near the end of your string to prevent JS thinking you are using it to escape the;
character.1)Ext.getCmp('txt').setValue(Ext.util.Format.htmlDecode(getSel.data.Message));
使用 Ext.util.Format.htmlDecode
第二部分是
参数:{
msg: (Ext.getCmp('txt').getValue())
无需编码
3)
Page Language="C#" AutoEventWireup="true" CodeBehind="Msg.aspx.cs" Inherits="Msg" ValidateRequest="假”%>
打开消息.aspx
添加 ValidateRequest="false"
1)Ext.getCmp('txt').setValue(Ext.util.Format.htmlDecode(getSel.data.Message));
use Ext.util.Format.htmlDecode
2nd part is
params: {
msg: (Ext.getCmp('txt').getValue())
no need to encode
3)
Page Language="C#" AutoEventWireup="true" CodeBehind="Msg.aspx.cs" Inherits="Msg" ValidateRequest="false" %>
open Msg.aspx
add in ValidateRequest="false"