WOLFRAM LANGUAGE TUTORIAL

Special Characters

In addition to the ordinary characters that appear on a standard keyboard, you can include in the Wolfram System strings any of the special characters that are supported by the Wolfram Language.

Here is a string containing special characters.
In[1]:=
Click for copyable input
Out[1]=
You can manipulate this string just as you would any other.
In[2]:=
Click for copyable input
Out[2]=
Here is the list of the characters in the string.
In[3]:=
Click for copyable input
Out[3]=

In a Wolfram System notebook, a special character such as can always be displayed directly. But if you use a textbased interface, then often the only characters that can readily be displayed are the ones that appear on your keyboard. Exactly which special characters can be displayed is inferred from the value of $CharacterEncoding.

As a result, what the Wolfram System does in such situations is to try to approximate special characters by similarlooking sequences of ordinary characters. And when this is not practical, the Wolfram System just gives the full name of the special character.

In a Wolfram System notebook using StandardForm, special characters can be displayed directly.
In[4]:=
Click for copyable input
Out[4]=
In OutputForm, however, special characters that cannot be displayed exactly are approximated when possible by sequences of ordinary ones.
In[5]:=
Click for copyable input
Out[5]=

When using InputForm or FullForm, special characters are not approximated. The Wolfram Language uses full names for non-representable special characters in InputForm, while FullForm always uses long names, even in the notebook interface.

In InputForm, all characters not part of the encodingin this case the special characters other than éare written using long names.
In[6]:=
Click for copyable input
Out[6]=
In FullForm, all special characters are written using long names.
In[7]:=
Click for copyable input
Out[7]//FullForm=

By default, the Wolfram System uses the character encoding when saving notebooks and packages. This means that when special characters are written out to files or external programs, they are represented purely as sequences of ordinary characters. This uniform representation is crucial in allowing special characters in the Wolfram Language to be used in a way that does not depend on the details of particular computer systems.

When creating packages and notebooks, special characters are always written out using full names.
In[8]:=
Click for copyable input
Out[8]=
Use the to create strings with no special characters.
In[9]:=
Click for copyable input
Out[9]=
In InputForm, all special characters are written out fully when using .
In[10]:=
Click for copyable input
Out[10]=
aa literal character
\[Name]a character specified using its full name
a to be included in a string
a to be included in a string

Ways to enter characters in a string.

You have to use to "escape" any or characters in strings that you enter.
In[11]:=
Click for copyable input
Out[11]=
produces a literal rather than forming part of the specification of .
In[12]:=
Click for copyable input
Out[12]=
This breaks the string into a list of individual characters.
In[13]:=
Click for copyable input
Out[13]=
This creates a list of the characters in the full name of .
In[14]:=
Click for copyable input
Out[14]=
And this produces a string consisting of an actual from its full name.
In[15]:=
Click for copyable input
Out[15]=