Function: multibyte-char-to-unibyte

multibyte-char-to-unibyte is a function defined in character.c.

Signature

(multibyte-char-to-unibyte CH)

Documentation

Convert the multibyte character CH to a byte.

If the multibyte character does not represent a byte, return -1.

Probably introduced at or before Emacs version 20.3.

Source Code

// Defined in /usr/src/emacs/src/character.c
{
  int cm;

  CHECK_CHARACTER (ch);
  cm = XFIXNAT (ch);
  if (cm < 256)
    /* Can't distinguish a byte read from a unibyte buffer from
       a latin1 char, so let's let it slide.  */
    return ch;
  else
    {
      int cu = CHAR_TO_BYTE_SAFE (cm);
      return make_fixnum (cu);
    }
}