Function: detect-coding-string

detect-coding-string is a function defined in coding.c.

Signature

(detect-coding-string STRING &optional HIGHEST)

Documentation

Detect coding system of the text in STRING.

Return a list of possible coding systems ordered by priority. The coding systems to try and their priorities follows what the function coding-system-priority-list (which see) returns.

If only ASCII characters are found (except for such ISO-2022 control characters as ESC), it returns a list of single element undecided or its subsidiary coding system according to a detected end-of-line format.

If optional argument HIGHEST is non-nil, return the coding system of highest priority.

View in manual

Probably introduced at or before Emacs version 20.3.

Source Code

// Defined in /usr/src/emacs/src/coding.c
{
  CHECK_STRING (string);

  return detect_coding_system (SDATA (string),
			       SCHARS (string), SBYTES (string),
			       !NILP (highest), STRING_MULTIBYTE (string),
			       Qnil);
}