Reason (CharacterTranslationException property)

From m204wiki
Revision as of 19:38, 14 January 2011 by 198.242.244.47 (talk) (Created page with " <span class="pageSubtitle"><section begin=dpl_desc/>TranslationExceptionReason enumeration value indicating the type of error causing the exception<section end=dpl_desc/></span>...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

<section begin=dpl_desc/>TranslationExceptionReason enumeration value indicating the type of error causing the exception<section end=dpl_desc/>

Reason is a member of the CharacterTranslationException class.

Syntax

%reason = %chTransEx:Reason

Syntax terms

%reason This TranslationExceptionReason enumeration value describes the reason for the translation failure.
%chTransEx 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, &#x2122; for the trademark character) may validly represent a Unicode character to be translated. Any other string that begins with by an ampersand (&) — except the string &amp; — 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.