Wolfram: Source Code Encoding and Unicode

By Xah Lee. Date: . Last updated: .

Wolfram Source Code is ASCII Only

Wolfram source code and the notebook, is saved in ASCII character set only.

Wolfram Supports Unicode Characters

Wolfram supports Unicode characters. e.g. α 😃

Syntax of Unicode Characters

Unicode characters are represented in source code in one of the following syntax.

\[Name]

Named character syntax. e.g. \[Alpha] for α (U+3B1: GREEK SMALL LETTER ALPHA)

there are about 1k named characters.

\:hhhh

Lowercase 4 hexadecimal digits character syntax. e.g. \:6c34 for 水 (U+6C34: CJK IDEOGRAPH-6C34)

\|hhhhhh

Lowercase 6 hexadecimal digits character syntax. e.g. \|01f603 for 😃 (U+1F603: SMILING FACE WITH OPEN MOUTH)

What is Named Character

example of Wolfram named characters
GlyphSyntax
é\[EAcute]
É\[CapitalEAcute]
α\[Alpha]
Δ\[CapitalDelta]
\[CirclePlus]
\[Element]
\[Equivalent]
\[DoubleStruckCapitalR]

ListingOfNamedCharacters

Some Named Characters Are Not in Unicode

Some of the named chars are not in Unicode. For example:

Wolfram Language wolf ram char Wolfram Language icon char 2021-06-06 Wolfram Language special char 2021-06-06 MzRbH
characters available only in Wolfram Language

Some Unicode Math Symbols Are Not in Named Chars

(Wolfram has only over 1k named characters. Unicode has over 140k characters.)

Example of Unicode Characters that Are Not in Wolfram Named Characters

Which Unicode Character Are Mapped to Wolfram Named Character

when you paste in unicode text to Wolfram Notebook , some characters are mapped to Wolfram named characters.

However, some unicode char such as (U+211D: DOUBLE-STRUCK CAPITAL R) does not map to the similar named char \[DoubleStruckCapitalR]

Am not aware of a document that list all the named characters and the unicode they map to.

Interpretation of Unicode Characters

When you paste in a unicode character, how does Wolfram Language interpret it?

If Not Mapped to a Named Character

If the character does not map to one of the named character, it is treated like any letter, such as a b c. You can use it in variable name or function name. For example:

Table[♥ , {♥, 1, 5}]

(* {1, 2, 3, 4, 5} *)

Type of Named Chars: Letter or Letter-Like Forms, vs Operator

A named character is one of two types:

Each character in these class may or may not have builtin meaning.

Here's a tree illustration:

Letter and Letter-Like-Form, vs Operator

If it's letter or letter-like forms, either it has a builtin meaning, e.g. ° same as Degree, π same as Pi, same as Infinity, or it is treated as any letter, such as λ. It is treated the same as any of a, b, c etc. You can use it as part of variable/function name.

If it's a operator, either it has a builtin meaning, such as Or it does not have builtin meaning, such as .

Operator Characters

xtodo

Operator characters have builtin syntactic meaning, i.e. unary or binary operator, and operator precedence.


A named character many have special meaning in Wolfram Language. For example, π \[Pi] is automatically considered identical to the built-in symbol Pi, which means the mathematical constant. (So, if you type \[Pi] or \:03c0, they are displayed as π with meaning of Pi.). Here's some examples of special meaning named chars.

Example of named characters, is letter or letter-like, with builtin meaning
GlyphWolfram syntaxUnicode nameUnicode hexadecimalDefault Interpretation
π\[Pi]GREEK SMALL LETTER PIU+3C0Pi
\[Infinity]INFINITYU+221EInfinity
°\[Degree]DEGREE SIGNU+B0Degree
Example of named characters, is operator, with builtin meaning
GlyphWolfram syntaxUnicode nameUnicode hexadecimalDefault Interpretation
\[Sqrt]SQUARE ROOTU+221Aoperator for Sqrt
\[GreaterEqual]GREATER-THAN OR EQUAL TOU+2265operator for GreaterEqual
\[Intersection]N-ARY INTERSECTIONU+22C2operator for Intersection
\[Sum]N-ARY SUMMATIONU+2211part of operator for Sum
\[Integral]INTEGRALU+222Bpart of operator for Integrate
\[CirclePlus]CIRCLED PLUSU+2295operator for CirclePlus

keyboard Shortcut Alias for Named Chars

A named character may have one or more aliases for ease of input. For example, to enter α, you can type EscaEsc or EscalphaEsc. Here's some examples:

GlyphCommon Alias
αa
πp
inf
<=
°deg
ΔD
el
->

Inputting Special Chars

You can input a special character by: