Reason (CharacterTranslationException property): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (match syntax table to syntax template, tags and edits)
Line 1: Line 1:
{{Template:CharacterTranslationException:Reason subtitle}}
{{Template:CharacterTranslationException:Reason subtitle}}
==Syntax==
==Syntax==
{{Template:CharacterTranslationException:Reason syntax}}
{{Template:CharacterTranslationException:Reason syntax}}
Line 6: Line 5:
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%reason</th>
<tr><th>%reason</th>
<td>This TranslationExceptionReason enumeration value describes the reason for the translation failure.
<td>This <var>TranslationExceptionReason</var> enumeration value describes the reason for the translation failure.
</td></tr>
</td></tr>
<tr><th>%chTransEx</th>
<tr><th>characterTranslationException</th>
<td>A reference to an instance of a CharacterTranslationException object.
<td>A reference to an instance of a <var>[[CharacterTranslationException_class|CharacterTranslationException]]</var> object.
</td></tr></table>


</td></tr></table>
==Usage notes==
==Usage notes==
<ul>
<ul>
<li>A TranslationExceptionReason enumeration may have one of the following values:
<li>A <var>TranslationExceptionReason</var> enumeration may have one of the following values:
<dl>
<dl>
<dt>InvalidEncoding
<dt>InvalidEncoding
<dd>An example of invalid encoding is UTF-16 string input to
<dd>An example of invalid encoding is UTF-16 string input to <var>[[Utf16ToUnicode (String function)|Utf16ToUnicode]]</var> that contains bytes whose hexadecimal value is D800 (which is in the surrogates range).
<var>[[Utf16ToUnicode (String function)|Utf16ToUnicode]]</var> that contains bytes whose hexadecimal
value is D800 (which is in the surrogates range).
<dt>InvalidCharacterReference
<dt>InvalidCharacterReference
<dd>An XML-style hexadecimal character reference (for example, <code>&amp;amp;#x2122;</code>
<dd>An XML-style hexadecimal character reference (for example, <code>&amp;amp;#x2122;</code> for the trademark character) may validly represent a [[Unicode]] character to be translated. Any other string that begins with by an ampersand (&amp;) &amp;mdash; except the string <code>&amp;amp;amp;</code> &amp;mdash; might cause an exception explained by an <var class="term">InvalidCharacterReference</var> enumeration.
for the trademark character) may validly represent a Unicode character to
<p>For example, such an exception occurs if <var>[[EbcdicToUnicode (String function)|EbcdicToUnicode]]</var> is called, the method argument is <code>CharacterDecode=True</code>, and the method input contains an ampersand followed by a space.</p>
be translated.
Any other string that begins with by an ampersand (&amp;) &amp;mdash;
except the string <code>&amp;amp;amp;</code> &amp;mdash;
might cause an exception explained by an InvalidCharacterReference enumeration.
 
For example, such an exception occurs if
<var>[[EbcdicToUnicode (String function)|EbcdicToUnicode]]</var> is called, the method argument is
<code>CharacterDecode=True</code>, and the method input
contains an ampersand followed by a space.
<dt>UntranslatableCharacter
<dt>UntranslatableCharacter
<dd>The following are examples of untranslatable characters
<dd>The following are examples of untranslatable characters (with the translation tables as delivered by Sirius):  
(with the translation tables as delivered by Sirius):
<ul>
<ul>
<li>The EBCDIC input to the EbcdicToUnicode method
<li>The EBCDIC input to the <var>[[EbcdicToUnicode_(String_function)|EbcdicToUnicode]]</var> method contains a byte whose hexadecimal value is X'FF.
contains a byte whose hexadecimal value is X'FF.
<li>The Unicode input to <var>[[UnicodeToEbcdic (Unicode function)|UnicodeToEbcdic]]</var> contains one of the many [[Unicode]] characters that is not translated to an EBCDIC character (for example, U+20AC, the Euro currency symbol).
<li>The Unicode input to <var>[[UnicodeToEbcdic (Unicode function)|UnicodeToEbcdic]]</var>
contains one of the many
Unicode characters that is not translated to an EBCDIC character
(for example, U+20AC, the Euro currency symbol).
</ul>
</ul>
</dl>
</dl>
<li>As with all enumerations, you use
<li>As with all enumerations, you use the <code>ToString</code> method to convert an enumeration value to a character string whose value is the name of the enumeration value.
the <code>ToString</code> method to convert an enumeration value to a
character string whose value is the name of the enumeration value.
</ul>
</ul>
==See also==
==See also==
{{Template:CharacterTranslationException:Reason footer}}
{{Template:CharacterTranslationException:Reason footer}}

Revision as of 05:26, 15 April 2011

Enumerated cause of the exception (CharacterTranslationException class)

Syntax

%translationExceptionReason = characterTranslationException:Reason

Syntax terms

%reason This TranslationExceptionReason enumeration value describes the reason for the translation failure.
characterTranslationException A reference to an instance of a CharacterTranslationException object.

Usage notes

  • A TranslationExceptionReason enumeration may have one of the following values:
    InvalidEncoding
    An example of invalid encoding is UTF-16 string input to Utf16ToUnicode that contains bytes whose hexadecimal value is D800 (which is in the surrogates range).
    InvalidCharacterReference
    An XML-style hexadecimal character reference (for example, &amp;#x2122; for the trademark character) may validly represent a Unicode character to be translated. Any other string that begins with by an ampersand (&) &mdash; except the string &amp;amp; &mdash; might cause an exception explained by an InvalidCharacterReference enumeration.

    For example, such an exception occurs if EbcdicToUnicode is called, the method argument is CharacterDecode=True, and the method input contains an ampersand followed by a space.

    UntranslatableCharacter
    The following are examples of untranslatable characters (with the translation tables as delivered by Sirius):
    • The EBCDIC input to the EbcdicToUnicode method contains a byte whose hexadecimal value is X'FF.
    • The Unicode input to UnicodeToEbcdic contains one of the many Unicode characters that is not translated to an EBCDIC character (for example, U+20AC, the Euro currency symbol).
  • As with all enumerations, you use the ToString method to convert an enumeration value to a character string whose value is the name of the enumeration value.

See also