Function: auth-source--decode-octal-string

auth-source--decode-octal-string is a byte-compiled function defined in auth-source.el.gz.

Signature

(auth-source--decode-octal-string STRING)

Documentation

Convert octal STRING to utf-8 string. E.g.: "a\\134b" to "a\\b".

Source Code

;; Defined in /usr/src/emacs/lisp/auth-source.el.gz
(defun auth-source--decode-octal-string (string)
  "Convert octal STRING to utf-8 string.  E.g.: \"a\\134b\" to \"a\\b\"."
  (let ((list (string-to-list string))
        (size (length string)))
    (decode-coding-string
     (apply #'unibyte-string
            (cl-loop for i = 0 then (+ i (if (eq (nth i list) ?\\) 4 1))
                     for var = (nth i list)
                     while (< i size)
                     if (eq var ?\\)
                     collect (string-to-number
                              (concat (cl-subseq list (+ i 1) (+ i 4))) 8)
                     else
                     collect var))
     'utf-8)))