Function: STRING-TO-OCTETS

Documentation

Convert STRING, a list string, a vector of bytes according to ENCODING. ENCODING is a keyword representing the desired character encoding. We gurantee that :UTF-8, :UTF-16 and :ISO-8859-1 will work as expected. Any other values are simply passed to the underlying lisp's function and the results are implementation dependant. On CLISP we intern the ENCODING symbol in the CHARSET package and pass that. On SBCL we simply pass the keyword.

Source

(defun string-to-octets (string encoding)
  "Convert STRING, a list string, a vector of bytes according to ENCODING.

ENCODING is a keyword representing the desired character
encoding. We gurantee that :UTF-8, :UTF-16 and :ISO-8859-1 will
work as expected. Any other values are simply passed to the
underlying lisp's function and the results are implementation
dependant.

On CLISP we intern the ENCODING symbol in the CHARSET package and
pass that. On SBCL we simply pass the keyword."
  (%string-to-octets string encoding))
Source Context