|
META TOPICPARENT |
name="TWikiVariables" |
|
|
< < | ENCODE{string} -- encode a string to URL or HTML entities
- Encode "special" characters to HTML numeric entities or to URL entities.
|
> > | ENCODE{string} -- encode a string to URL entities, HTML entities, CSV format, and more
- Encode "special" characters in a string to HTML numeric entities, URL entities. Also escapes special characters for CSV use and more.
|
|
- Encoded characters:
- all non-printable ASCII characters below space, except newline (
"\n" ) and linefeed ("\r" )
- HTML special characters
"<" , ">" , "&" , single quote (' ) and double quote (" )
|
|
type="entity" |
Encode special characters into HTML entities, like a double quote into " . Does not encode newline (\n ) or linefeed (\r ). |
type="url" |
type="entity" extra=" $n$r" |
For type="entity" only, use the extra parameter to encode additional characters to HTML numeric entities. Formatting tokens can be used, such as "$n" for newline. Note that type="entity" extra=" $n$r" is equivalent to type="html" . |
type="url" extra="" |
type="html" |
Encode special characters into HTML entities. In addition to type="entity" , it also encodes space, \n and \r . Useful to encode text properly in HTML input fields. See equivalent ENTITY. |
type="url" |
|
|
> > |
type="csv" |
Escape single quotes and double quotes by repeating them, other characters do not change. Use this to properly escape fields in CSV reports that output comma-separated values, such as "field 1","field 2 with ''single'' and ""double"" quotes" . |
type="url" |
newline="..." |
Replace a newline with the specified value before encoding. Please note that newline="<br/>" does not bring <br/> to the output because < and > are encoded (except with the quotes and csv types). To have <br/> in the output, you need to specify newline="$br" . However, newline="$br" does not work in combination with type="url" (the defautl type). This shouldn't be a problem because it's very rare to need to have <br/> encoded in a URL. In addition to $br , $n has a special meaning in a newline parameter value - $n results in a newline in the output. This parameter is expected to be used in combination with the moderate , safe , entity , or html type. With the other types, it causes unuseful results. |
|
|
|
- Examples:
-
%ENCODE{"spaced name"}% expands to spaced%20name
-
%ENCODE{"spaced name" type="entity" extra=" "}% expands to spaced name
|