Function: encode-sjis-char

encode-sjis-char is a function defined in coding.c.

Signature

(encode-sjis-char CH)

Documentation

Encode a Japanese character CH to shift_jis encoding.

Return the corresponding code in SJIS.

Source Code

// Defined in /usr/src/emacs/src/coding.c
{
  Lisp_Object spec, attrs, charset_list;
  int c;
  struct charset *charset;
  unsigned code;

  CHECK_CHARACTER (ch);
  c = XFIXNAT (ch);
  CHECK_CODING_SYSTEM_GET_SPEC (Vsjis_coding_system, spec);
  attrs = AREF (spec, 0);

  if (ASCII_CHAR_P (c)
      && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)))
    return ch;

  charset_list = CODING_ATTR_CHARSET_LIST (attrs);
  charset = char_charset (c, charset_list, &code);
  if (code == CHARSET_INVALID_CODE (charset))
    error ("Can't encode by shift_jis encoding: %c", c);
  JIS_TO_SJIS (code);

  return make_fixnum (code);
}