www.delorie.com/gnu/docs/elisp-manual-21/elisp_547.html   search  
Buy the book!

GNU Emacs Lisp Reference Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

33.6 Characters and Bytes

In multibyte representation, each character occupies one or more bytes. Each character set has an introduction sequence, which is normally one or two bytes long. (Exception: the ASCII character set and the EIGHT-BIT-GRAPHIC character set have a zero-length introduction sequence.) The introduction sequence is the beginning of the byte sequence for any character in the character set. The rest of the character's bytes distinguish it from the other characters in the same character set. Depending on the character set, there are either one or two distinguishing bytes; the number of such bytes is called the dimension of the character set.

Function: charset-dimension charset
This function returns the dimension of charset; at present, the dimension is always 1 or 2.

Function: charset-bytes charset
This function returns the number of bytes used to represent a character in character set charset.

This is the simplest way to determine the byte length of a character set's introduction sequence:

(- (charset-bytes charset)
   (charset-dimension charset))

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003