$Ent Tab: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
(Automatically generated page update)
 
(48 intermediate revisions by 3 users not shown)
Line 2: Line 2:
<span class="pageSubtitle">retrieve/modify character entity substitution table</span>
<span class="pageSubtitle">retrieve/modify character entity substitution table</span>


<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Ent_Tab function is [[to be entered]].</p>
<p class="warn"><b>Note: </b>Many $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $Ent_Tab function.</p>


This function retrieves or modifies the current active character entity translation table. This table is used by $Ent and the PRINT and HTML/TEXT statements when $Ent_Print is set to VAR or ON.  
This function retrieves or modifies the current active character entity translation table. This table is used by <var>$Ent</var> and the <var>Print</var> and <var>Html/Text</var> statements when <var>[[$Ent_Print]]</var> is set to <code>VAR</code> or <code>ON</code>.  


$Ent_Tab accepts one argument and returns a string result.  
<var>$Ent_Tab</var> accepts one argument and returns a string result.  


The first argument is the new entity translation table to be used by $Ent and $Ent_Print. It contains a blank-delimited set of token pairs, the first of each pair being the character to undergo substitution and the second the entity name to be substituted. The default substitution string which is set at the start of every request is &amp;OSQ.< lt &amp; amp " quot&amp;CSQ.. An ampersand (&amp;) is always placed in front of the entity name and a semicolon (;) after when substitution is performed so these should not be specified in the entity name. Alphanumerics characters '''must''' be specified as the their hexadecimal EBCDIC value, for example the "A" character must be specified as "C1". There is almost never a need to do character entity substitution for alphanumeric characters but this capability is provided for completeness. The space or blank character must always be specified as "40". Occasionally one might blanks to be represented as non-breaking spaces, generally indicated by "&amp;nobsp;". All other characters can be specified by the EBCDIC character or their hexadecimal values. The first parameter is an optional parameter and, if not specified $Ent_Tab simply returns the current character entity translation table.
==Syntax==
==Syntax==
<p class="syntax"><section begin="syntax" /> %RESULT = $Ent_Tab(string)
<p class="syntax"><span class="term">%result</span> = $Ent_Tab(string)
<section end="syntax" /></p>
<p class="caption">$Ent_Tab Function
</p>
</p>
<p class="caption">%RESULT is set to the character entity substitution table before the call.</p>


===Syntax terms===
<table class="syntaxTable">
<tr><th>%result</th>
<td>Set to the character entity substitution table before the call.</td></tr>


Specifying an invalid substitution table for $Ent_Tab causes request cancellation.  
<tr><th>%string</th>
<td>The new entity translation table to be used by <var>$Ent</var> and <var>$Ent_Print</var>. It contains a blank-delimited set of token pairs, the first of each pair being the character to undergo substitution and the second the entity name to be substituted.
<p>
The default substitution string which is set at the start of every request is <code>< lt &amp; amp " quot</code>. </p>
<p>
An ampersand (&amp;) is always placed in front of the entity name and a semicolon (;) after when substitution is performed, so these should not be specified in the entity name. Alphanumeric characters '''must''' be specified as the their hexadecimal EBCDIC value, for example the "A" character, must be specified as <code>C1</code>. There is almost never a need to do character entity substitution for alphanumeric characters but this capability is provided for completeness. </p>
<p>
The space or blank character must always be specified as <code>40</code>. Occasionally one might want blanks to be represented as non-breaking spaces, generally indicated by <code>&amp;nobsp;</code>. All other characters can be specified by the EBCDIC character or their hexadecimal values. </p>
<p>
The first parameter is an optional parameter and, if not specified <var>$Ent_Tab</var> simply returns the current character-entity translation table.</p></td></tr>
</table>


The return value from $Ent_Tab contains no leading or trailing spaces, contains only a single space between tokens, represents any alphanumeric characters as their hexadecimal values and all other characters as themselves, even if these characters are non-displayable. This is the most compact possible representation of a character entity substitution table so there need be no worries about truncation of the result of a $Ent_Tab call at 255 characters -- the result of the $Ent_Tab call will always be the same length or shorter than the value used to set the substitution table.  
==Usage notes==
<ul>
<li>Specifying an invalid substitution table for <var>$Ent_Tab</var> causes request cancellation.  


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;".  
<li>The return value from <var>$Ent_Tab</var> contains no leading or trailing spaces, contains only a single space between tokens, represents any alphanumeric characters as their hexadecimal values and all other characters as themselves, even if these characters are non-displayable. This is the most compact possible representation of a character entity substitution table so there need be no worries about truncation of the result of a <var>$Ent_Tab</var> call at 255 characters &#x2014; the result of the <var>$Ent_Tab</var> call will always be the same length or shorter than the value used to set the substitution table.  


The return value for $Ent_Tab is the $Ent_Tab setting before the function call which makes it easy to save the $Ent_Tab setting and then restore it. In addition, the fact that a $Ent_Tab without parameters simply returns the current substitution table makes it easy to add entities to the current table.
<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 <code>&amp;lt;</code> 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 <code>&</code>, "<" to <code>&amp;lt;</code> and the double-quote character to <code>&amp;quot;</code>.
 
<li>The return value for <var>$Ent_Tab</var> is the <var>$Ent_Tab</var> setting before the function call which makes it easy to save the <var>$Ent_Tab</var> setting and then restore it. In addition, the fact that a <var>$Ent_Tab</var> without parameters simply returns the current substitution table makes it easy to add entities to the current table.
</ul>
 
==Example==
In this example, the "nobsp" character entity is added to the current substitution table so that blanks in a converted string will be sent as non-breaking spaces, ensuring that the string will not be split to different lines:
In this example, the "nobsp" character entity is added to the current substitution table so that blanks in a converted string will be sent as non-breaking spaces, ensuring that the string will not be split to different lines:
<p class="code"> * Add nobsp to table, save old table
<p class="code">&#42; Add nobsp to table, save old table
%ENT_TAB = $Ent_Tab( $Ent_Tab WITH ' 40 nobsp')
%ENT_TAB = $Ent_Tab( $Ent_Tab WITH ' 40 nobsp')
   
   
HTML
HTML
Thank you {&amp; %NAME} for visiting our web site.
Thank you {&amp; %NAME} for visiting our web site.
It is always a pleasure serving you and
It is always a pleasure serving you and
{&amp; %COMPANY}
{&amp; %COMPANY}
END HTML
END HTML
   
   
* Back to old table
&#42; Back to old table
%ENT_TAB = $Ent_Tab(%ENT_TAB)
%ENT_TAB = $Ent_Tab(%ENT_TAB)
</p>
</p>


If a character is specified in the substitution string more than once, the last specification is used &#x2014; this makes it easy to temporarily override a character entity substitution using the above save and restore technique. So in the above example the local code does not need to worry about whether or not blanks were already undergoing character entity translation.


If a character is specified in the substitution string more than once, the last specification is used -- this makes it easy to temporarily override a character entity substitution using the above save and restore technique. So in the above example the local code does not need to worry about whether or not blanks were already undergoing character entity translation.


This $function is new in Version 6.2 of the ''[[Sirius Mods]]''.
==Products authorizing {{PAGENAMEE}}==
<ul class="smallAndTightList">
<ul class="smallAndTightList">
<li>[[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>[[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>[[Japanese functions]]</li>
<li>Japanese functions</li>
<li>[[Sir2000 Field Migration Facility]]</li>
<li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li>
 
</ul>
</ul>
<p class="caption">Products authorizing $Ent_Tab
</p>


[[Category:$Functions|$Ent_Tab]]
[[Category:$Functions|$Ent_Tab]]

Latest revision as of 22:51, 20 September 2018

retrieve/modify character entity substitution table

Note: Many $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $Ent_Tab function.

This function retrieves or modifies the current active character entity translation table. This table is used by $Ent and the Print and Html/Text statements when $Ent_Print is set to VAR or ON.

$Ent_Tab accepts one argument and returns a string result.

Syntax

%result = $Ent_Tab(string)

Syntax terms

%result Set to the character entity substitution table before the call.
%string The new entity translation table to be used by $Ent and $Ent_Print. It contains a blank-delimited set of token pairs, the first of each pair being the character to undergo substitution and the second the entity name to be substituted.

The default substitution string which is set at the start of every request is < lt & amp " quot.

An ampersand (&) is always placed in front of the entity name and a semicolon (;) after when substitution is performed, so these should not be specified in the entity name. Alphanumeric characters must be specified as the their hexadecimal EBCDIC value, for example the "A" character, must be specified as C1. There is almost never a need to do character entity substitution for alphanumeric characters but this capability is provided for completeness.

The space or blank character must always be specified as 40. Occasionally one might want blanks to be represented as non-breaking spaces, generally indicated by &nobsp;. All other characters can be specified by the EBCDIC character or their hexadecimal values.

The first parameter is an optional parameter and, if not specified $Ent_Tab simply returns the current character-entity translation table.

Usage notes

  • Specifying an invalid substitution table for $Ent_Tab causes request cancellation.
  • The return value from $Ent_Tab contains no leading or trailing spaces, contains only a single space between tokens, represents any alphanumeric characters as their hexadecimal values and all other characters as themselves, even if these characters are non-displayable. This is the most compact possible representation of a character entity substitution table so there need be no worries about truncation of the result of a $Ent_Tab call at 255 characters — the result of the $Ent_Tab call will always be the same length or shorter than the value used to set the substitution table.
  • 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 "&amp;" to &, "<" to &lt; and the double-quote character to &quot;.
  • The return value for $Ent_Tab is the $Ent_Tab setting before the function call which makes it easy to save the $Ent_Tab setting and then restore it. In addition, the fact that a $Ent_Tab without parameters simply returns the current substitution table makes it easy to add entities to the current table.

Example

In this example, the "nobsp" character entity is added to the current substitution table so that blanks in a converted string will be sent as non-breaking spaces, ensuring that the string will not be split to different lines:

* Add nobsp to table, save old table %ENT_TAB = $Ent_Tab( $Ent_Tab WITH ' 40 nobsp') HTML Thank you {& %NAME} for visiting our web site. It is always a pleasure serving you and {& %COMPANY} END HTML * Back to old table %ENT_TAB = $Ent_Tab(%ENT_TAB)

If a character is specified in the substitution string more than once, the last specification is used — this makes it easy to temporarily override a character entity substitution using the above save and restore technique. So in the above example the local code does not need to worry about whether or not blanks were already undergoing character entity translation.


Products authorizing $Ent_Tab