StringToByteArray

StringToByteArray["string"]

returns a byte array corresponding to the UTF-8 encoding of the specified string.

StringToByteArray["string","encoding"]

uses the specified character encoding.

Details

Examples

open allclose all

Basic Examples  (2)

Convert a string to a ByteArray of its UTF-8 representation:

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

Convert the bytes to a list of numbers:

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

Convert a string to a ByteArray of its ISO 8859-7 Latin/Greek representation:

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

Convert the bytes to a list of numbers:

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

Scope  (2)

Properties & Relations  (6)

Possible Issues  (2)

See Also

ByteArrayToString  ToCharacterCode  $CharacterEncodings  ExportByteArray  ByteArray  String

Introduced in 2017
(11.2)