decode-coding-string

decode-coding-string is a built-in function in `C source code'.

(decode-coding-string STRING CODING-SYSTEM &optional NOCOPY BUFFER)

Decode STRING which is encoded in CODING-SYSTEM, and return the result.

Optional third arg NOCOPY non-nil means it is OK to return STRING itself
if the decoding operation is trivial.

Optional fourth arg BUFFER non-nil means that the decoded text is
inserted in that buffer after point (point does not move). In this
case, the return value is the length of the decoded text.

This function sets `last-coding-system-used' to the precise coding system
used (which may be different from CODING-SYSTEM if CODING-SYSTEM is
not fully specified.)