Since JavaScript is available across such a wide variety of platforms, locales and environments, you may introduce some characters that appear to mutate as the script moves from one environment to another.
It is fairly safe to use any character in the lower 128 set that corresponds to ASCII. Even then, you may find that hash and GB pound signs get confused in some editors.
It is somewhat less safe to use the next 128 character codes up to 255 because these are mapped quite differently on Macintosh, UNIX and Windows systems.
If you can use a Unicode compliant environment, these problems may be minimized and the character you type will be the same on other platforms if they fully support Unicode. However they may not appear the same on non-Unicode platforms. In any case, a non-Unicode compliant platform may not support the 16 bit (double-byte) characters that Unicode requires and may only be able to cope with 8 bit characters.
Historically, only 7 bit character codes could be guaranteed to arrive intact, but these days 7 bit serial connections are in decline. Even so, you may find them on some ancillary equipment; in particular you may find rack mounted units that have an RS232 serial interface. You should be very ware of these since they may not support 16 bit character values.
This set of characters (plus the space, newline and tab characters) is the smallest safe set to write your script in. Any other characters can be encoded as escape sequences using these characters.
a b c d e f g h i j k l m
n o p q r s t u v w x y z
A B C D E F G H I J K L M
N O P Q R S T U V W X Y Z
0 1 2 3 4 5 6 7 8 9
! " # % & ' ( ) * + , - .
/ : ; < = > ? [ ` ] ^ _ { | } ~
A fully ECMA compliant interpreter should allow you the full use of the Unicode character set for specifying identifier names but this whole area of localization and internationalization is under discussion at the time of writing. Future versions of the ECMA 262 standard or appendices to it may clarify the situation.
See also: | isAlnum(), isAlpha(), isCtrl(), isDigit(), isGraph(), isLower(), isODigit(), isPrint(), isPunct(), isSpace(), isUpper(), isXDigit(), Printing character |
Prev | Home | Next |
Less than or equal to (<=) | Up | Lexical convention |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |