-1

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??

user715045
  • 155
  • 1
  • 5
  • 15

2 Answers2

0

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.

// Original:
a:"<font color=blue>testing!@#$%^&*()_+{}|:"<>?-=[]\;',./"

You can tell by the syntax highlighting that the original string is terminated premature.

// Escaped:
a:"<font color=blue>testing!@#$%^&*()_+{}|:\"<>?-=[]\\;',./"

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.

Ivar Bonsaksen
  • 4,747
  • 2
  • 32
  • 34
0

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"

user715045
  • 155
  • 1
  • 5
  • 15