$Ent Print: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
m (remove "Sirius")
 
(8 intermediate revisions by 2 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="warn"><b>Note: </b>Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $Ent_Print function.</p>
<p class="warn"><b>Note: </b>Many Model&nbsp;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 PRINT and HTML/TEXT statements. At the start of every request the <var>$Ent_Print</var> setting is OFF meaning no character entity substitution is done for the output from PRINT or HTML statements.  
This function retrieves or sets the current automatic character entity substitution setting for <var>Print</var> and <var>Html/Text</var> statements.  


<var>$Ent</var> accepts one argument and returns a string result.  
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.  


The first argument is the new setting of automatic character entity substitution and must be either
<var>$Ent_Print</var> accepts one argument and returns a string result.
<table class="syntaxTable">
 
==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>which means no character entity substitution will be done on PRINT or HTML/TEXT statement output.</td></tr>
<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>which means character entity substitution will be done on all PRINT and HTML/TEXT statement output.</td></tr>
<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>which means 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>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 and if not specified or specified as null, the current <var>$Ent_Print</var> setting is not altered.
</table>
==Syntax==
<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 class="syntax"><span class="term">%result</span> = $Ent_Print(val)
</p>
<p>
<p>
</p>
Specifying an invalid value for <var>$Ent_Print</var> causes request cancellation. </p>
<p><var class="term">%result</var> is set to the <var>$Ent_Print</var> setting before the call.</p>
</td></tr>
</table>


Specifying an invalid value for <var>$Ent_Print</var> causes request cancellation.  
==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>$Ent_Print</var> 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.
<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>&amp;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>&amp;</code> to <code>&amp;amp;</code>, <code><</code> to <code>&amp;lt;</code> and the double quote character <code>"</code> to <code>&amp;quot;</code>. </p>
<p>
The active character entity substitution table can be modified with <var>[[$Ent_Tab]]</var>.</p></li>


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 "&amp;lt;" character entity. A default character entity substitution table is provided which does the basic required character entity mappings for HTML and XML of "&amp;amp." to "&amp;amp.amp;", "<" to "&amp;lt;" and the double quote character to "&amp;quot;". The active character entity substitution table can be modified with $Ent_Tab [[$Ent_Tab]].
<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 which makes it easy to save the <var>$Ent_Print</var> setting and then restore it.
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 'ON' and then restored to its previous setting.
<p class="code">SUBROUTINE HEADER
<p class="code"> SUBROUTINE HEADER
   
   
%ENT_PRINT IS STRING LEN 32
%ENT_PRINT IS STRING LEN 32
  * I'm too lazy to type all those &amp;lt;'s
  * I'm too lazy to type all those &amp;lt;'s
%ENT_PRINT = $Ent_Print('ON')
%ENT_PRINT = $Ent_Print('ON')
   
   
PRINT '<<<<<<<<<<<<<< Header >>>>>>>>>>>>>>'
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')
%ENT_PRINT = $Ent_Print('ON')
</p>
</p></li>


Generally, the most useful setting for <var>$Ent_Print</var> is VAR because it's 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 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 <var>$Ent_Print</var> 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 &amp; or a !) can explicitly force or prevent character entity translation.  
<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>&amp;</code> or an <code>!</code>) can explicitly force or prevent character entity translation. </p></li>
</ul>


==Products authorizing {{PAGENAMEE}}==  
==Products authorizing {{PAGENAMEE}}==  
Line 51: Line 71:
<li>[[List of $functions|Sirius functions]]</li>
<li>[[List of $functions|Sirius functions]]</li>
<li>[[Fast/Unload User Language Interface]]</li>
<li>[[Fast/Unload User Language Interface]]</li>
<li>[http://m204wiki.rocketsoftware.com/images/4/4a/JoclrNew.pdf Janus Open Client]</li>
<li>[[Media:JoclrNew.pdf|Janus Open Client]]</li>
<li>[http://m204wiki.rocketsoftware.com/images/1/17/JosrvrNew.pdf 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>Japanese functions</li>
<li>Japanese functions</li>
<li>[http://m204wiki.rocketsoftware.com/images/4/4b/SirfieldNew.pdf Sir2000 Field Migration Facility]</li>
<li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li>
 
</ul>
</ul>
<p>
</p>


[[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:
OFF No character entity substitution will be done on PRINT or HTML/TEXT statement output.
ON Character entity substitution will be done on all PRINT and HTML/TEXT statement output.
VAR 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.

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 &lt; character entity.

    A default character entity substitution table is provided which does the basic required character entity mappings for HTML and XML of & to &amp;, < to &lt; and the double quote character " to &quot;.

    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 &lt;'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.

Products authorizing $Ent_Print