Utf8ToUnicode (String function): Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
|||
Line 2: | Line 2: | ||
The Utf8ToUnicode function is available as of version 7.3 of the [[Sirius Mods]]. | The Utf8ToUnicode function is available as of version 7.3 of the [[Sirius Mods]]. | ||
===Utf8ToUnicode syntax=== | ===Utf8ToUnicode syntax=== | ||
%unicode = string:Utf8ToUnicode | %unicode = string:Utf8ToUnicode | ||
===Syntax Terms=== | ===Syntax Terms=== | ||
<dl> | <dl> | ||
<dt>%unicode | <dt>%unicode | ||
<dd>A string variable to receive the method object string translated to Unicode. | <dd>A string variable to receive the method object string translated to Unicode. | ||
<dt>string | <dt>string | ||
<dd>A String or Longstring that is presumed to contain a UTF-8 byte stream. | <dd>A String or Longstring that is presumed to contain a UTF-8 byte stream. | ||
</dl> | </dl> | ||
Line 17: | Line 17: | ||
<dl> | <dl> | ||
<dt>[[CharacterTranslationException]] | <dt>[[CharacterTranslationException]] | ||
<dd>If the method encounters a translation problem, properties of the exception object may indicate the location and type of problem. | <dd>If the method encounters a translation problem, properties of the exception object may indicate the location and type of problem. | ||
</dl> | </dl> | ||
===Usage Notes=== | ===Usage Notes=== | ||
*[[Utf8 and Utf16]] has more information about UTF-8 conversions. | *[[Utf8 and Utf16]] has more information about UTF-8 conversions. | ||
*The [[ | *The [[Utf16ToUnicode (String function)|Utf16ToUnicode]] method converts a UTF-16 byte stream to Unicode. | ||
*The [[ | *The [[UnicodeToUtf8 (String function)|UnicodeToUtf8]] method converts a Unicode string to a UTF-8 Longstring byte stream. | ||
===Examples=== | ===Examples=== | ||
In the following fragment, Utf8ToUnicode converts a hexadecimal input to a single Unicode character. In case the Unicode character translates to an EBCDIC character that cannot be displayed, the CharacterEncode option of the [[ | In the following fragment, Utf8ToUnicode converts a hexadecimal input to a single Unicode character. In case the Unicode character translates to an EBCDIC character that cannot be displayed, the CharacterEncode option of the [[UnicodeToEbcdic (Unicode function)|UnicodeToEbcdic]] method | ||
causes the output of a hexadecimal character reference. The ''''[[ | causes the output of a hexadecimal character reference. The ''''[[X (String function)|X]]'''' constant function is used in the example. | ||
%u Unicode | %u Unicode | ||
%u = 'E284A2':X:Utf8ToUnicode | %u = 'E284A2':X:Utf8ToUnicode |
Revision as of 22:44, 21 October 2010
This intrinsic function converts a UTF-8 Longstring byte stream to Unicode.
The Utf8ToUnicode function is available as of version 7.3 of the Sirius Mods.
Utf8ToUnicode syntax
%unicode = string:Utf8ToUnicode
Syntax Terms
- %unicode
- A string variable to receive the method object string translated to Unicode.
- string
- A String or Longstring that is presumed to contain a UTF-8 byte stream.
Exceptions
This intrinsic function can throw the following exception:
- CharacterTranslationException
- If the method encounters a translation problem, properties of the exception object may indicate the location and type of problem.
Usage Notes
- Utf8 and Utf16 has more information about UTF-8 conversions.
- The Utf16ToUnicode method converts a UTF-16 byte stream to Unicode.
- The UnicodeToUtf8 method converts a Unicode string to a UTF-8 Longstring byte stream.
Examples
In the following fragment, Utf8ToUnicode converts a hexadecimal input to a single Unicode character. In case the Unicode character translates to an EBCDIC character that cannot be displayed, the CharacterEncode option of the UnicodeToEbcdic method causes the output of a hexadecimal character reference. The 'X' constant function is used in the example.
%u Unicode %u = 'E284A2':X:Utf8ToUnicode Print %u:unicodeToEbcdic(CharacterEncode=true)
The result of the above fragment is the character reference for the trademark character:
™