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


User-Chosen Coding Systems

Function: select-safe-coding-system from to &optional preferred-coding-system
This function selects a coding system for encoding the text between from and to, asking the user to choose if necessary.

The optional argument preferred-coding-system specifies a coding system to try first. If that one can handle the text in the specified region, then it is used. If this argument is omitted, the current buffer's value of buffer-file-coding-system is tried first.

If the region contains some multibyte characters that the preferred coding system cannot encode, this function asks the user to choose from a list of coding systems which can encode the text, and returns the user's choice.

One other kludgy feature: if from is a string, the string is the target text, and to is ignored.

Here are two functions you can use to let the user specify a coding system, with completion. See section Completion.

Function: read-coding-system prompt &optional default
This function reads a coding system using the minibuffer, prompting with string prompt, and returns the coding system name as a symbol. If the user enters null input, default specifies which coding system to return. It should be a symbol or a string.

Function: read-non-nil-coding-system prompt
This function reads a coding system using the minibuffer, prompting with string prompt, and returns the coding system name as a symbol. If the user tries to enter null input, it asks the user to try again. See section Coding Systems.


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