Skip to main content

Text.from_bytes

Text.from_bytesbytesencoding on_problems

Documentation

Takes a vector of bytes and returns Text resulting from decoding it using the specified encoding.

Arguments

  • bytes: The vector of UTF-8 bytes.
  • encoding: The text encoding to decode the bytes with. Defaults to UTF-8.
  • on_problems: Specifies the behavior when a problem occurs during the function. By default, a dataflow error is raised.

Examples

Decode a sequence of ASCII bytes into Text.

      Text.from_bytes [72, 101, 108, 108, 111] (Encoding.ascii)