Team LiB   Previous Section   Next Section
Unicode Text

Allowed coercions

list with one item; strings or international text, but some text information may be lost

Syntax

set worldlyStr to "A Unicode string" as Unicode text

Description

Unicode text values reserve two bytes of memory for each character. This allows Unicode text to represent up to about 65,000 characters from languages throughout the world (Version 3.01 of the Unicode Standard defined more than 49,000 characters), including Arabic, Chinese, Japanese, Korean, and numerous others. The Unicode Standard is an evolving standard for international character encoding (see http://www.unicode.org).

Prior to AppleScript Version 1.5.5, the Script Editor can only display Unicode text as raw data, but its class is preserved as Unicode text.

AppleScript 1.6 on OS X and OS 9.1 can display Unicode text as a string, as in "A."

Examples

This AppleScript shows what a returned Unicode text value looks like in AppleScript Version 1.5.5 and later, and in AppleScript Version 1.4:

set UnicodeStr to "Hi" as Unicode text

(* returns<<data utxt00480069>> in AppleScript version 1.4; and "Hi" 

in version 1.5.5 and later*)

The raw-data return value is comprised of the word <<data>> and the actual Unicode text data enclosed in guillemet symbols (<< >>). The Unicode text data begins with a four-character code representing the Unicode text class ("utxt") and then a hexadecimal representation of the characters in the string. These characters are represented as "00480069" inside of the raw-data return value.

    Team LiB   Previous Section   Next Section