|ToCharacterCode["string"]||give a list of the character codes for the characters in a string|
|FromCharacterCode[n]||construct a character from its character code|
|construct a string of characters from a list of character codes|
Converting to and from character codes.
assigns every character that can appear in a string a unique character code
. This code is used internally as a way to represent the character.
This gives the character codes for the characters in the string.
Special characters also have character codes.
|CharacterRange["c1","c2"]||generate a list of characters with successive character codes|
Generating sequences of characters.
This gives part of the English alphabet.
Here is the Greek alphabet.
assigns names such as \[Alpha]
to a large number of special characters. This means that you can always refer to such characters just by giving their names, without ever having to know their character codes.
This generates a string of special characters from their character codes.
You can always refer to these characters by their names, without knowing their character codes.
has names for all the common characters that are used in mathematical notation and in standard European languages. But for a language such as Japanese, there are more than 3,000 additional characters, and Mathematica
does not assign an explicit name to each of them. Instead, it refers to such characters by standardized character codes.
Here is a string containing Japanese characters.
, these characters are referred to by standardized character codes. The character codes are given in hexadecimal.
The notebook front end for Mathematica
is typically set up so that when you enter a character in a particular font, Mathematica
will automatically work out the character code for that character.
Sometimes, however, you may find it convenient to be able to enter characters directly using character codes.
|\0||null byte (code 0)|
|\.nn||a character with hexadecimal code nn|
|\:nnnn||a character with hexadecimal code nnnn|
Ways to enter characters directly in terms of character codes.
For characters with character codes below 256, you can use \.nn
. For characters with character codes above 256, you must use \:nnnn
. Note that in all cases you must give a fixed number of hexadecimal digits, padding with leading 0s if necessary.
This gives character codes in hexadecimal for a few characters.
This enters the characters using their character codes. Note the leading 0 inserted in the character code for
In assigning codes to characters, Mathematica
follows three compatible standards: ASCII, ISO Latin-1, and Unicode. ASCII covers the characters on a normal American English keyboard. ISO Latin-1 covers characters in many European languages. Unicode is a more general standard which defines character codes for several tens of thousands of characters used in languages and notations around the world.
|0 - 127 (\.00 - \.7f)||ASCII characters|
|1 - 31 (\.01 - \.1f)||ASCII control characters|
|32 - 126 (\.20 - \.7e)||printable ASCII characters|
|97 - 122 (\.61 - \.7a)||lower-case English letters|
|129 - 255 (\.81 - \.ff)||ISO Latin-1 characters|
|192 - 255 (\.c0 - \.ff)||letters in European languages|
|0 - 59391 (\:0000 - \:e7ff)||Unicode standard public characters|
913 - 1009 (\:0391 - \:03f1)
12288 - 35839 (\:3000 - \:8bff)
|Chinese, Japanese and Korean characters|
8450 - 8504 (\:2102 - \:2138)
|modified letters used in mathematical notation|
8592 - 8677 (\:2190 - \:21e5)
8704 - 8945 (\:2200 - \:22f1)
|mathematical symbols and operators|
64256 - 64300 (\:fb00 - \:fb2c)
|Unicode private characters defined specially by Mathematica|
A few ranges of character codes used by Mathematica.
Here are all the printable ASCII characters.
Here are some ISO Latin-1 letters.
Here are some special characters used in mathematical notation. The empty boxes correspond to characters not available in the current font.
Here are a few Japanese characters.