FromCharacterCode

FromCharacterCode[n]

gives a string consisting of the character with integer code n.

FromCharacterCode[{n1,n2,}]

gives a string consisting of the sequence of characters with codes ni.

FromCharacterCode[{{n11,n12,},{n21,},}]

gives a list of strings.

FromCharacterCode[,"encoding"]

uses the specified character encoding.

Details

  • The integer n must lie between 0 and 1114112, as returned by ToCharacterCode.
  • For n between 0 and 127, FromCharacterCode returns ASCII characters.
  • For n between 129 and 255, it returns ISO Latin1 characters.
  • For other n, it returns characters specified by the standard Wolfram Language encoding based on Unicode.
  • FullForm[FromCharacterCode[n]] gives the full name assigned to a special character with character code n.
  • Whether a particular character generated by FromCharacterCode can be rendered on your output device will depend on what fonts and drivers you are using.
  • Encodings supported in FromCharacterCode[,"encoding"] are given by $CharacterEncodings.

Examples

open all close all

Basic Examples  (2)

Give a string consisting of the sequence of characters with codes 97, 98, and 99:

In[1]:=
Click for copyable input
Out[1]=

Obtain character codes:

In[1]:=
Click for copyable input
Out[1]=

FromCharacterCode reconstructs the original string:

In[2]:=
Click for copyable input
Out[2]=

Scope  (4)

Applications  (1)

Properties & Relations  (4)

Introduced in 1991
(2.0)
|
Updated in 2019
(12.0)