Utf8ToUnicode (String function): Difference between revisions
Jump to navigation
Jump to search
m (match syntax diagram to revised template; fix tags and links) |
m (bad closing tage) |
||
Line 10: | Line 10: | ||
<td>A string variable to receive the method object <var class="term">string</var> translated to <var>Unicode</var>.</td></tr> | <td>A string variable to receive the method object <var class="term">string</var> translated to <var>Unicode</var>.</td></tr> | ||
<tr><th>string</th> | <tr><th>string</th> | ||
<td>The method object <var>string</var> that is presumed to contain a UTF-8 byte stream.</td></tr> | <td>The method object <var class="term">string</var> that is presumed to contain a UTF-8 byte stream.</td></tr> | ||
<tr><th>AllowUntranslatable</th> | <tr><th>AllowUntranslatable</th> | ||
<td | <td></td> | ||
</table> | </table> | ||
Line 40: | Line 40: | ||
<ul><li><var>[[Unicode#UTF-8_and_UTF-16|Utf8 and Utf16]]</var> has more information about UTF-8 conversions. | <ul><li><var>[[Unicode#UTF-8_and_UTF-16|Utf8 and Utf16]]</var> has more information about UTF-8 conversions. | ||
<li><var>[[UnicodeToUtf8_(Unicode_function)|UnicodeToUtf8]]</var> converts a <var>Unicode</var> string to a UTF-8 <var>Longstring</var> byte stream. | <li><var>[[UnicodeToUtf8_(Unicode_function)|UnicodeToUtf8]]</var> converts a <var>Unicode</var> string to a UTF-8 <var>Longstring</var> byte stream. | ||
<li><var>[[Utf16ToUnicode (String function)|Utf16ToUnicode]] converts a UTF-16 byte stream to <var>Unicode</var>. | <li><var>[[Utf16ToUnicode (String function)|Utf16ToUnicode]]</var> converts a UTF-16 byte stream to <var>Unicode</var>. | ||
</ul> | </ul> | ||
{{Template:String:Utf8ToUnicode footer}} | {{Template:String:Utf8ToUnicode footer}} |
Revision as of 23:38, 3 February 2011
Convert a UTF-8 Longstring bytestream to Unicode (String class)
The Utf8ToUnicode intrinsic function converts a UTF-8 string to Unicode.
Syntax
%unicode = string:Utf8ToUnicode[( [AllowUntranslatable= boolean])] Throws CharacterTranslationException
Syntax terms
%unicode | A string variable to receive the method object string translated to Unicode. |
---|---|
string | The method object string that is presumed to contain a UTF-8 byte stream. |
AllowUntranslatable |
Exceptions
Utf8ToUnicode 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
- Utf8ToUnicode is available as of Sirius Mods Version 7.3.
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 UnicodeToEbcdic 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:
™
See also
- Utf8 and Utf16 has more information about UTF-8 conversions.
- UnicodeToUtf8 converts a Unicode string to a UTF-8 Longstring byte stream.
- Utf16ToUnicode converts a UTF-16 byte stream to Unicode.