Vipers
Encoding vipers
The following table displays the characters being replaced for the various HTML, XML and SXML encoding vipers. Please note that numeric and character entity references are not taken into account when performing an encode operation.
Viper | < | > | & | " | ' | { |
---|---|---|---|---|---|---|
string.htmlencode(data) | < | > | & | " | ' | { |
string.htmlencode(data, includeQuotes) | < | > | & | " 1) | ' 1) | { |
string.sxmlencode(data) | < | > | & | " | ' | { |
string.sxmlencode(data, includeQuotes) | < | > | & | " 1) | ' 1) | { |
string.xmlencode(data) | < | > | & | " | ' | { |
string.xmlencode(data, includeQuotes) | < | > | & | " 1) | ' 1) | { |
string.xmlencode(data, codingOptions) | < 1) | > 1) | & 1) | " 1) | ' 1) | { 1) |
string.encodeampersand(data) | < | > | & | " | ' | { |
string.encodeattribute(data) | < | > | &; | " | ' | { |
string.encodeattribute(data, removeTags) | < 1) | < 1) | & | " | ' | { |
string.encodequotes(data) | < | > | & | " | ' | { |
sxml.disable(data) | < 2) | > 2) | & | " | ' | { 3) |
1) Depends on input parameters
2) Only for xml start and end tags in the Smartsite XML namespace (default prefix se:). Tags in other XML namespaces are left intact.
3) Only for curly brackets that precede a valid viper.
The vipers EncodeAttribute and EncodeQuotes encode an apostrophe character (') into it's numeric entity reference counterpart and not into the named entity reference '. The reason for this is that Internet Explorer doesn't handle the ' named entity in XHTML very well and will display the named character string as-is.
Decoding vipers
The following table lists the characters replacing entity references when decoding.
Viper | < | > | & | " | ' | numeric | char |
---|---|---|---|---|---|---|---|
string.htmldecode(data) | < | > | & | " | ' | yes | yes |
string.htmldecode(data, includeQuotes) | < | > | & | " 1) | ' 1) | yes | yes |
string.sxmldecode(data) | < | > | & | " | ' | yes | no |
string.sxmldecode(data, includeQuotes) | < | > | & | " 1) | ' 1) | yes | no |
string.xmldecode(data) | < | > | & | " | ' | yes | no |
string.xmldecode(data, includeQuotes) | < | > | & | " 1) | ' 1) | yes | no |
string.xmldecode(data, codingOptions) | < 1) | > 1) | & 1) | " 1) | ' 1) | yes 1) | yes 1) |
string.decodeampersand(data) | < | > | & | " | ' | no | no |
1) Depends on input parameters