Go to the first, previous, next, last section, table of contents.


Selecting a Representation

Sometimes it is useful to examine an existing buffer or string as multibyte when it was unibyte, or vice versa.

Function: set-buffer-multibyte multibyte
Set the representation type of the current buffer. If multibyte is non-nil, the buffer becomes multibyte. If multibyte is nil, the buffer becomes unibyte.

This function leaves the buffer contents unchanged when viewed as a sequence of bytes. As a consequence, it can change the contents viewed as characters; a sequence of two bytes which is treated as one character in multibyte representation will count as two characters in unibyte representation.

This function sets enable-multibyte-characters to record which representation is in use. It also adjusts various data in the buffer (including overlays, text properties and markers) so that they cover the same text as they did before.

Function: string-as-unibyte string
This function returns a string with the same bytes as string but treating each byte as a character. This means that the value may have more characters than string has.

If string is unibyte already, then the value is string itself.

Function: string-as-multibyte string
This function returns a string with the same bytes as string but treating each multibyte sequence as one character. This means that the value may have fewer characters than string has.

If string is multibyte already, then the value is string itself.


Go to the first, previous, next, last section, table of contents.