About strings and the String class
451
You can associate each character with a specified character code, which you can also optionally
use to display text. For example, the character “A” is represented by the Unicode character
code 0041, or 65 in ASCII (American Standard Code for Information Interchange). For more
information on character codes and code charts, see
www.unicode.org/charts
. As you can see,
the way you represent strings in a Flash document depends a lot on the character set you
choose, and the way you encode characters.
Character encoding
refers to the code, or method, for representing a set of characters in a
language to representative codes, such as numeric values. The
character code
(as mentioned in
the previous paragraph) is the table of mapped values (such as the ASCII table, where A equals
65). The encoding method deciphers it in a computer program.
For example, each letter in the English language would have a representative numerical code
in a character encoding. ASCII encodes each letter, number, and some symbols to 7-bit binary
versions of each integer. ASCII is a character set consisting of 95 printable characters and
numerous control characters; ASCII is used by computers to represent text.
Like ASCII,
Unicode
is another way to associate a code with each letter of the alphabet.
Because ASCII cannot support large character sets, such as Chinese, the Unicode Standard is a
valuable standard to encode languages. Unicode is the standard for character sets that can
represent any language set. It is a standard that exists to help development in multiple
languages. The character code designates what character it represents, and the standard
attempts to provide a universal way to encode characters that are part of any language. Strings
could be displayed on any computer system, or platform, or software used. Then, it is up to
the program involved (such as Flash or a web browser) to display the character glyph (its visual
appearance).
Over the years, the number of characters that Unicode supports has expanded to add support
for more (and larger) languages. The character encodings are called Unicode Transformation
Format (UTF) and Universal Character Set (UCS), which include UTF-8, UTF-16, and
UTF-32. The numbers in UTF encoding represent the number of bits in a unit, and the
numbers in a UCS encoding represent bytes.
■
UTF-8 is the standard encoding for exchanging text, such as online mail systems. UTF is
an 8-bit system.
■
UTF-16 is commonly used for internal processing.
Strings can be of various lengths in your applications. You can determine the length of your
string, although this might vary, depending on what language you’re using. Also, you might
encounter a terminating character at the end of a string, and this null character doesn’t have a
value. This terminating character is not an actual character, but you can use it to determine
when a string ends. For example, if you’re working with socket connections, you might watch
for the terminating character to know the end of a string (such as in a chat program).
Содержание FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Страница 1: ...Learning ActionScript 2 0 in Flash...
Страница 8: ...8 Contents...
Страница 18: ...18 Introduction...
Страница 30: ...30 What s New in Flash 8 ActionScript...
Страница 66: ...66 Writing and Editing ActionScript 2 0...
Страница 328: ...328 Interfaces...
Страница 350: ...350 Handling Events...
Страница 590: ...590 Creating Interaction with ActionScript...
Страница 710: ...710 Understanding Security...
Страница 730: ...730 Debugging Applications...
Страница 780: ...780 Deprecated Flash 4 operators...
Страница 830: ...830 Index...