How Mathematica does Unicode?

, , …,

This page explains some tech detail about how Mathematica uses Unicode.

Mathematica supports Unicode, but does not use Unicode when saving to file. γ€”β˜›Β Unicode Basics: What's Character Set, Character Encoding, UTF-8?〕

Mathematica files use 7-bits ASCII only. http://www.wolfram.com/technology/nb/

How does it support Unicode if it uses only ASCII?

Mathematica reverse list-2-2
Mathematica notebook
Mathematica syntax StandardForm screenshot
Mathematica notebook

Mathematica's Named Characters \[Name]

Mathematica has a set of special characters with the syntax \[name]. For example:

GlyphSyntax
Γ©\[EAcute]
Γ‰\[CapitalEAcute]
Ξ±\[Alpha]
Ξ”\[CapitalDelta]
βŠ•\[CirclePlus]
∡\[Because]
∈\[Element]
⇔\[Equivalent]
ℝ\[DoubleStruckCapitalR]

So, when you type \[Alpha], it is displayed as β€œΞ±β€. (All built-in symbols in Mathematica starts with capital letter.)

You can think of them as HTML's β€œnamed character entities”. γ€”β˜›Β Character Sets and Encoding in HTML〕 There are about 900 named chars. http://reference.wolfram.com/mathematica/guide/ListingOfNamedCharacters.html

Many of the named chars are also in Unicode, but not all. Similarly, many Math Symbols in Unicode are not in this list. Also, Unicode's Chinese chars, Arabic alphabets etc, are not in Mathematica's named chars.

Map Between Unicode and Named Chars

When you paste a Unicode char into Mathematica, Mathematica will try to interpret the Unicode as one of the named char.

So, for example, if you paste β€œΞ±β€ (GREEK SMALL LETTER ALPHA; β€œU+x3b1”), it automatically becomes Mathematica's \[Alpha], and displayed as β€œΞ±β€.

Syntax for Arbitrary Unicode Char

For any Unicode that's not one of Mathematica's named char (such as Chinese chars), their syntax is this: \:xxxx, where the xxxx is Unicode's 4 digit hexidecimal representation of the char. For example, the Chinese char β€œζ°΄β€ (water), Unicode hex is β€œ6c34”, in Mathematica is: \:6c34.

The above roughly summarize how Mathematica takes Unicode as input.

Some Named Chars has Built-in Meaning

Of the named chars, many has special meaning in Mathematica. 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.

GlyphMathematica's nameUnicode nameUnicode hexidecimalDefault Interpretation
β‰₯\[GreaterEqual]GREATER-THAN OR EQUAL TO2265GreaterThan
Ο€\[Pi]GREEK SMALL LETTER PI03c0Pi
∞\[Infinity]INFINITY221eInfinity
∫\[Integral]INTEGRAL222bIntegrate
β‹‚\[Intersection]N-ARY INTERSECTION22c2Union
βˆ‘\[Sum]N-ARY SUMMATION2211Sum
√\[Sqrt]SQUARE ROOT221aSqrt
βŠ•\[CirclePlus]CIRCLED PLUS2295CirclePlus

Note: it appears that it is possible to over-ride the default interpretation of named char to built-in symbol (function, constant), for all or some of the named char. (i haven't investigated on how yet.)

Alias Shortcut for Named Chars

Some of the named char has 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:

blog comments powered by Disqus