Function: dbus-byte-array-to-string

dbus-byte-array-to-string is a byte-compiled function defined in dbus.el.gz.

Signature

(dbus-byte-array-to-string BYTE-ARRAY)

Documentation

Transform BYTE-ARRAY with UTF-8 byte sequence into a string.

BYTE-ARRAY must be a list of structure (c1 c2 ...), or a byte array as produced by dbus-string-to-byte-array, and the individual bytes must be a valid UTF-8 byte sequence.

Probably introduced at or before Emacs version 30.1.

Source Code

;; Defined in /usr/src/emacs/lisp/net/dbus.el.gz
(defun dbus-byte-array-to-string (byte-array &optional _multibyte)
  "Transform BYTE-ARRAY with UTF-8 byte sequence into a string.
BYTE-ARRAY must be a list of structure (c1 c2 ...), or a byte array as
produced by `dbus-string-to-byte-array', and the individual bytes must
be a valid UTF-8 byte sequence."
  (declare (advertised-calling-convention (byte-array) "30.1"))
  (if-let* ((bytes (seq-filter #'characterp byte-array))
            (string (apply #'unibyte-string bytes)))
      (let (last-coding-system-used)
        (decode-coding-string string 'utf-8 'nocopy))
    ""))