
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
The String Type
|
87
\u0040 // The @ sign
\u00A9 // The copyright symbol
\u0041 // The capital letter "A"
\u2014 // The em dash
A code point is a unique identification number that is assigned to each character in
the Unicode character set. See Appendix B for a list of the Unicode code points for
Latin 1. Code points for other languages can be found in the character charts at the
Unicode Consortium site:
http://www.unicode.org/charts
If you have trouble finding a character amongst the thousands of code points, con-
sult the Unicode Consortium’s helpful suggestions:
http://www.unicode.org/unicode/standard/where/
To escape characters from the Latin 1 character set only, we can use a short form for
the standard Unicode escape sequence. The short form consists of the prefix
\x fol-
lowed by a two-digit hexadecimal number that represents the Latin 1 code point of
the character. Since Latin 1 code points are the same as the first 256 Unicode code
points, you can still use the reference chart in Appendix B, but simply remove the
u00, as in the following examples:
\u0040 // Unicode escape sequence
\x40 // \x shortcut form
\u00A9 // Unicode...
\xA9 // ...you get the idea
In addition to using Unicode escape sequences, we can insert any character into a
string via the built-in fromCharCode( ) function, described ...