Monday, June 26, 2017
  • Index
  •  » Core Language
  •  » What is the difference between "string", "text", "unicode text"...?

#1 2005-10-13 03:19:52 pm

julifos
Administrator
From: Malasa├▒a, Madrid
Registered: 2002-11-20
Posts: 2014

What is the difference between "string", "text", "unicode text"...?

A string is a bunch of characters of the ASCII table (including extended ASCII, that is, all the 256 characters). First 128 characters are the standard ASCII table. The rest, are displayed according to our language preferences in the Universal preference pane (usually, mac-roman).

text is the same.

styled text is a string containing information about the standard styles: on styles (that is plain, bold, italic, underline, outline, shadow, condensed, expanded), font id, size, color, etc.

Unicode text is supossed to contain any character in the known languages (latin, japanese, etc.). The information is kept in two or more bytes. If you are thinking in a multi-language solution in your script, you may use this kind of text as your standard.

International text is a special concept used in Macintosh. It contains information about the language code and script code of the following bytes, and it is displayed according to this information using the language kit installed in your machine. This type is not used very much in the applescript world.

C string is now a deprecated data-type commonly used in C and other languages. It is a series of bytes followed by a null byte (ASCII character 0).

Pascal string is also a deprecated data-type. The first byte is the count of following bytes (so, a maximum of 255 bytes can be contained in a Pascal string).

Both C string and Pascal string don't have a representation (eg, you can't display them in a "display dialog" command), since they are raw data.

AppleScript understands as well some other kinds of raw data. For example, you can declare "├?┬źdata utxt0061├?┬╗", and this is the raw-data representation of the Unicode text character "a". You can also create the UTF-8 representation of "a" stating "├?┬źdata utf861├?┬╗". The C string correlative would be "├?┬źdata cstr6100├?┬╗" (ascii 61 followed by a null), and the Pascal string "├?┬źdata pstr0161├?┬╗" (the count, hex 1, plus ascii 61).

UTF-8 is typically not a data-type defined in AppleScript, but you can still read and write UTF-8 data using the "├?┬źclass utf8├?┬╗" class.

There is also encoded string ("text encoded using the Text Encoding Converter", according to AppleScript's dictionary), but there is not known utility for this class.

Offline

 
  • Index
  •  » Core Language
  •  » What is the difference between "string", "text", "unicode text"...?

Board footer

Powered by FluxBB

[ Generated in 0.026 seconds, 8 queries executed ]

RSS (new topics) RSS (active topics)