$Ent Print: Difference between revisions
m (1 revision) |
m (remove "Sirius") |
||
(19 intermediate revisions by 3 users not shown) | |||
Line 2: | Line 2: | ||
<span class="pageSubtitle">Set automatic character entity substitution</span> | <span class="pageSubtitle">Set automatic character entity substitution</span> | ||
<p class=" | <p class="warn"><b>Note: </b>Many Model 204 $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the <var>$Ent_Print</var> function.</p> | ||
This function retrieves or sets the current automatic character entity substitution setting for | This function retrieves or sets the current automatic character entity substitution setting for <var>Print</var> and <var>Html/Text</var> statements. | ||
<var>$ | At the start of every request the <var>$Ent_Print</var> setting is <var>OFF</var>, meaning no character entity substitution is done for the output from <var>Print</var> or <var>Html/Text</var> statements. | ||
<var>$Ent_Print</var> accepts one argument and returns a string result. | |||
<table class=" | |||
==Syntax== | |||
<p class="syntax"><span class="term">%result</span> = $Ent_Print([<span class="term">val</span>]) | |||
</p> | |||
<table> | |||
<tr><th>%result</th> | |||
<td>A <var>String</var> that is set to the <var>$Ent_Print</var> setting before the call. </td></tr> | |||
<tr><th>val</th> | |||
<td>The new setting of automatic character entity substitution; it must be one of these: | |||
<table class="thJustBold"> | |||
<tr><th>OFF</th> | <tr><th>OFF</th> | ||
<td> | <td>No character entity substitution will be done on PRINT or HTML/TEXT statement output.</td></tr> | ||
<tr><th>ON</th> | <tr><th>ON</th> | ||
<td> | <td>Character entity substitution will be done on all PRINT and HTML/TEXT statement output.</td></tr> | ||
<tr><th>VAR</th> | <tr><th>VAR</th> | ||
<td> | <td>Character entity substitution will be done only on variable PRINT and HTML/TEXT statement output, that is anything that is not a string literal or a static variable in a PRINT statement and anything inside a start/end expression bracket in an HTML statement. | ||
</td></tr></table> | </td></tr> | ||
This is an optional argument | </table> | ||
<p class="note"><b>Note:</b> This is an optional argument; if not specified or specified as null, the current <var>$Ent_Print</var> setting is not altered.</p> | |||
<p> | <p> | ||
</ | Specifying an invalid value for <var>$Ent_Print</var> causes request cancellation. </p> | ||
<p> | </td></tr> | ||
</table> | |||
==usage notes== | |||
<ul> | |||
<li>The <var>$Ent_Print</var> setting can be overridden in an <var>Html/Text</var> statement by the <var>ENT_PRINT</var> setting on that statement or by the special <code>*</code> or <code>!</code> characters following the expression start string in an expression. </li> | |||
The <var>$ | <li>Character entity substitution replaces characters that have special meaning to an HTML or XML processor with their character entity representation. For example, the <code><</code> is represented as the <code>&lt;</code> character entity. | ||
<p> | |||
A default character entity substitution table is provided which does the basic required character entity mappings for HTML and XML of <code>&</code> to <code>&amp;</code>, <code><</code> to <code>&lt;</code> and the double quote character <code>"</code> to <code>&quot;</code>. </p> | |||
<p> | |||
The active character entity substitution table can be modified with <var>[[$Ent_Tab]]</var>.</p></li> | |||
<li>The return value for <var>$Ent_Print</var> is the <var>$Ent_Print</var> setting before the function call. This makes it easy to save the <var>$Ent_Print</var> setting and then restore it. | |||
<p> | |||
The return value for <var>$Ent_Print</var> is the <var>$Ent_Print</var> setting before the function call | In this example, <var>$Ent_Print</var> is set to <code>ON</code> and then restored to its previous setting:</p> | ||
In this example, <var>$Ent_Print</var> is set to | <p class="code">SUBROUTINE HEADER | ||
<p class="code"> SUBROUTINE HEADER | |||
%ENT_PRINT IS STRING LEN 32 | |||
* I'm too lazy to type all those &lt;'s | * I'm too lazy to type all those &lt;'s | ||
%ENT_PRINT = $Ent_Print('ON') | |||
PRINT '<<<<<<<<<<<<<< Header >>>>>>>>>>>>>>' | |||
* But shouldn't mess with <var>$Ent_Print</var> setting | * But shouldn't mess with <var>$Ent_Print</var> setting | ||
%ENT_PRINT = $Ent_Print('ON') | |||
</p> | </p></li> | ||
Generally, the most useful setting for <var>$Ent_Print</var> is VAR because it | <li>Generally, the most useful setting for <var>$Ent_Print</var> is <var>VAR</var>, because it is hard to be sure that variable data, whether it comes from a database field or from user input, doesn't contain special HTML or XML characters. Literal strings, on the other hand, are likely to contain XML or HTML tags, so they should not undergo character entity substitution. | ||
<p> | |||
Occasionally, it is useful to place HTML or XML tags in a %variable. If possible, that variable should be <var>STATIC</var> so a <var>VAR</var> setting for <var>$Ent_Print</var> will not modify it. If this is not possible, it is probably best to use the <var>Html/Text</var> statement, where a single character after the expression start character(s) (an <code>&</code> or an <code>!</code>) can explicitly force or prevent character entity translation. </p></li> | |||
</ul> | |||
==Products authorizing {{PAGENAMEE}}== | |||
<li>[[Sirius functions]]</li> | <ul class="smallAndTightList"> | ||
<li>[[List of $functions|Sirius functions]]</li> | |||
<li>[[Fast/Unload User Language Interface]]</li> | <li>[[Fast/Unload User Language Interface]]</li> | ||
<li>[[Janus Open Client]]</li> | <li>[[Media:JoclrNew.pdf|Janus Open Client]]</li> | ||
<li>[[Janus Open Server]]</li> | <li>[[Media:JosrvrNew.pdf|Janus Open Server]]</li> | ||
<li>[[Janus Sockets]]</li> | <li>[[Janus Sockets]]</li> | ||
<li>[[Janus Web Server]]</li> | <li>[[Janus Web Server]]</li> | ||
<li> | <li>Japanese functions</li> | ||
<li>[[Sir2000 Field Migration Facility]]</li> | <li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li> | ||
</ul> | </ul> | ||
[[Category:$Functions|$Ent_Print]] | [[Category:$Functions|$Ent_Print]] |
Latest revision as of 17:07, 5 June 2017
Set automatic character entity substitution
Note: Many Model 204 $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $Ent_Print function.
This function retrieves or sets the current automatic character entity substitution setting for Print and Html/Text statements.
At the start of every request the $Ent_Print setting is OFF, meaning no character entity substitution is done for the output from Print or Html/Text statements.
$Ent_Print accepts one argument and returns a string result.
Syntax
%result = $Ent_Print([val])
%result | A String that is set to the $Ent_Print setting before the call. | ||||||
---|---|---|---|---|---|---|---|
val | The new setting of automatic character entity substitution; it must be one of these:
Note: This is an optional argument; if not specified or specified as null, the current $Ent_Print setting is not altered. Specifying an invalid value for $Ent_Print causes request cancellation. |
usage notes
- The $Ent_Print setting can be overridden in an Html/Text statement by the ENT_PRINT setting on that statement or by the special
*
or!
characters following the expression start string in an expression. - Character entity substitution replaces characters that have special meaning to an HTML or XML processor with their character entity representation. For example, the
<
is represented as the<
character entity.A default character entity substitution table is provided which does the basic required character entity mappings for HTML and XML of
&
to&
,<
to<
and the double quote character"
to"
.The active character entity substitution table can be modified with $Ent_Tab.
- The return value for $Ent_Print is the $Ent_Print setting before the function call. This makes it easy to save the $Ent_Print setting and then restore it.
In this example, $Ent_Print is set to
ON
and then restored to its previous setting:SUBROUTINE HEADER %ENT_PRINT IS STRING LEN 32 * I'm too lazy to type all those <'s %ENT_PRINT = $Ent_Print('ON') PRINT '<<<<<<<<<<<<<< Header >>>>>>>>>>>>>>' * But shouldn't mess with $Ent_Print setting %ENT_PRINT = $Ent_Print('ON')
- Generally, the most useful setting for $Ent_Print is VAR, because it is hard to be sure that variable data, whether it comes from a database field or from user input, doesn't contain special HTML or XML characters. Literal strings, on the other hand, are likely to contain XML or HTML tags, so they should not undergo character entity substitution.
Occasionally, it is useful to place HTML or XML tags in a %variable. If possible, that variable should be STATIC so a VAR setting for $Ent_Print will not modify it. If this is not possible, it is probably best to use the Html/Text statement, where a single character after the expression start character(s) (an
&
or an!
) can explicitly force or prevent character entity translation.