Follow

HTML Special Characters

If you are adding strings in code, i.e. something like:

 

string s = “abc” + “def”

 

Then the escape character is a \ i.e.

 

String s = “abc\"def \r\n and so on"

 

If you want to output a string inside the value of a property of an html attribute, i.e. something like:

 

<tag attrib="[[=variable;]]">

 

And the variable potentially contains special characters that can’t be put in an attribute, then you want this:

 

<tag attrib="[[=System.Encoding.htmlentities(variable);]]">

0 Comments

Please sign in to leave a comment.