Character Codes

ToCharacterCode["string"]give a list of the character codes for the characters in a string
FromCharacterCode[n]construct a character from its character code
FromCharacterCode[{n1,n2,}]construct a string of characters from a list of character codes

Converting to and from character codes.

The Wolfram Language 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.
In[1]:=
Click for copyable input
Out[1]=
FromCharacterCode reconstructs the original string.
In[2]:=
Click for copyable input
Out[2]=
Special characters also have character codes.
In[3]:=
Click for copyable input
Out[3]=
CharacterRange["c1","c2"]generate a list of characters with successive character codes

Generating sequences of characters.

This gives part of the English alphabet.
In[4]:=
Click for copyable input
Out[4]=
Here is the Greek alphabet.
In[5]:=
Click for copyable input
Out[5]=

The Wolfram Language assigns names such as 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.
In[6]:=
Click for copyable input
Out[6]=
You can always refer to these characters by their names, without knowing their character codes.
In[7]:=
Click for copyable input
Out[7]//FullForm=

The Wolfram Language 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 the Wolfram Language 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.
In[8]:=
Click for copyable input
Out[8]=
In FullForm, these characters are referred to by standardized character codes. The character codes are given in hexadecimal.
In[9]:=
Click for copyable input
Out[9]//FullForm=

The notebook front end for the Wolfram System is typically set up so that when you enter a character in a particular font, the Wolfram System 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.

.nna character with hexadecimal code nn
\:nnnna 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 . For characters with character codes above 256, you must use . 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.
In[10]:=
Click for copyable input
Out[10]//BaseForm=
This enters the characters using their character codes. Note the leading 0 inserted in the character code for .
In[11]:=
Click for copyable input
Out[11]=

In assigning codes to characters, the Wolfram Language follows three compatible standards: ASCII, ISO Latin1, and Unicode. ASCII covers the characters on a normal American English keyboard. ISO Latin1 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. Unicode characters are represented using their UTF-16 mappings.

0127 (.00.7f)ASCII characters
131 (.01.1f)ASCII control characters
32126 (.20.7e)printable ASCII characters
97122 (.61.7a)lowercase English letters
129255 (.81.ff)ISO Latin1 characters
192255 (.c0.ff)letters in European languages
059391 (:0000:e7ff)Unicode standard public characters
9131009 (:0391:03f1)
Greek letters
1228835839 (:3000:8bff)
Chinese, Japanese, and Korean characters
84508504 (:2102:2138)
modified letters used in mathematical notation
85928677 (:2190:21e5)
arrows
87048945 (:2200:22f1)
mathematical symbols and operators
6144063487 (:f000:f7ff)
Unicode private characters defined specially by the Wolfram Language

A few ranges of character codes used by the Wolfram Language.

Here are all the printable ASCII characters.
In[12]:=
Click for copyable input
Out[12]=
Here are some ISO Latin1 letters.
In[13]:=
Click for copyable input
Out[13]=
Here are some special characters used in mathematical notation. The empty boxes correspond to characters not available in the current font.
In[14]:=
Click for copyable input
Out[14]=
Here are a few Japanese characters.
In[15]:=
Click for copyable input
Out[15]=