check-coding-systems-region is a built-in function in `C source code'.

(check-coding-systems-region START END CODING-SYSTEM-LIST)

Check if the region is encodable by coding systems.

START and END are buffer positions specifying the region.
CODING-SYSTEM-LIST is a list of coding systems to check.

The value is an alist ((CODING-SYSTEM POS0 POS1 ...) ...), where
CODING-SYSTEM is a member of CODING-SYSTEM-LIST and can't encode the
whole region, POS0, POS1, ... are buffer positions where non-encodable
characters are found.

If all coding systems in CODING-SYSTEM-LIST can encode the region, the
value is nil.

START may be a string. In that case, check if the string is
encodable, and the value contains indices to the string instead of
buffer positions. END is ignored.

If the current buffer (or START if it is a string) is unibyte, the value
is nil.